ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
Bulky.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /* Copyright (c) 2019 Nils Haagen <nils.haagen@concepts-and-training.de> Extended GPL, see docs/LICENSE */
6 
8 
9 use ILIAS\UI\Component as C;
11 
12 class Bulky extends Link implements C\Link\Bulky
13 {
15 
16  // allowed ARIA roles
17  public const MENUITEM = 'menuitem';
18 
22  protected $label;
23 
27  protected $aria_role;
28 
32  protected $symbol;
33 
37  protected static $allowed_aria_roles = array(
38  self::MENUITEM
39  );
40 
41  public function __construct(C\Symbol\Symbol $symbol, string $label, \ILIAS\Data\URI $target)
42  {
43  parent::__construct($target->__toString());
44  $this->label = $label;
45  $this->symbol = $symbol;
46  }
47 
51  public function getLabel() : string
52  {
53  return $this->label;
54  }
55 
59  public function getSymbol() : C\Symbol\Symbol
60  {
61  return $this->symbol;
62  }
63 
70  public function withAriaRole(string $aria_role) : Bulky
71  {
72  $this->checkArgIsElement(
73  "role",
74  $aria_role,
75  self::$allowed_aria_roles,
76  implode('/', self::$allowed_aria_roles)
77  );
78  $clone = clone $this;
79  $clone->aria_role = $aria_role;
80  return $clone;
81  }
82 
88  public function getAriaRole() : ?string
89  {
90  return $this->aria_role;
91  }
92 }
This describes a symbol.
Definition: Symbol.php:11
checkArgIsElement($which, $value, $array, $name)
Throw an InvalidArgumentException if $value is not an element of array.
Class ChatMainBarProvider .
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.
__construct(Container $dic, ilPlugin $plugin)