ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
Icon.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
23 use ILIAS\UI\Component as C;
26 
27 abstract class Icon implements C\Symbol\Icon\Icon
28 {
29  use ComponentHelper;
31 
35  protected static array $possible_sizes = array(
36  self::SMALL,
37  self::MEDIUM,
38  self::LARGE,
39  self::RESPONSIVE
40  );
41 
42  protected string $name;
43  protected string $label;
44  protected string $size;
45  protected ?string $abbreviation = null;
46  protected bool $is_disabled;
47 
51  public function getName(): string
52  {
53  return $this->name;
54  }
55 
59  public function getLabel(): string
60  {
61  return $this->label;
62  }
63 
64  public function setLabel(string $label): void
65  {
66  $this->label = $label;
67  }
68 
72  public function withAbbreviation(string $abbreviation): C\Symbol\Icon\Icon
73  {
74  $clone = clone $this;
75  $clone->abbreviation = $abbreviation;
76  return $clone;
77  }
78 
82  public function getAbbreviation(): ?string
83  {
84  return $this->abbreviation;
85  }
86 
90  public function withSize(string $size): C\Symbol\Icon\Icon
91  {
92  $this->checkArgIsElement(
93  "size",
94  $size,
95  self::$possible_sizes,
96  implode('/', self::$possible_sizes)
97  );
98  $clone = clone $this;
99  $clone->size = $size;
100  return $clone;
101  }
102 
106  public function getSize(): string
107  {
108  return $this->size;
109  }
110 
114  public function isDisabled(): bool
115  {
116  return $this->is_disabled;
117  }
118 
122  public function withDisabled(bool $is_disabled): C\Symbol\Icon\Icon
123  {
124  $clone = clone $this;
125  $clone->is_disabled = $is_disabled;
126  return $clone;
127  }
128 }
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...
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.