ILIAS  release_8 Revision v8.23
Bulky.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
22 
23 use ILIAS\UI\Component as C;
25 
29 class Bulky extends Button implements C\Button\Bulky
30 {
31  // allowed ARIA roles
32  public const MENUITEM = 'menuitem';
33 
35  protected ?string $aria_role = null;
36 
40  protected static array $allowed_aria_roles = array(self::MENUITEM);
41 
42  public function __construct(Symbol $icon_or_glyph, string $label, string $action)
43  {
44  $this->icon_or_glyph = $icon_or_glyph;
45  $this->label = $label;
46  $this->action = $action;
47  }
48 
52  public function getIconOrGlyph(): Symbol
53  {
54  return $this->icon_or_glyph;
55  }
56 
65  public function withAriaRole(string $aria_role): C\Button\Bulky
66  {
67  $this->checkArgIsElement(
68  "role",
69  $aria_role,
70  self::$allowed_aria_roles,
71  implode('/', self::$allowed_aria_roles)
72  );
73  $clone = clone $this;
74  $clone->aria_role = $aria_role;
75  return $clone;
76  }
77 
81  public function getAriaRole(): ?string
82  {
83  return $this->aria_role;
84  }
85 }
This describes a symbol.
Definition: Symbol.php:29
__construct(Symbol $icon_or_glyph, string $label, string $action)
Definition: Bulky.php:42
getAriaRole()
Get the ARIA role on the button.
Definition: Bulky.php:81
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21
withAriaRole(string $aria_role)
Get a button like this, but with an additional ARIA role.
Definition: Bulky.php:65