ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Mode.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 2016 Jesús López <lopez@leifos.de> Extended GPL, see docs/LICENSE */
4 
6 
7 use ILIAS\UI\Component as C;
9 
10 class Mode implements C\ViewControl\Mode
11 {
12  use ComponentHelper;
13 
17  protected $labeled_actions;
18 
22  protected $aria_label;
23 
27  protected $active;
28 
29  public function __construct($labelled_actions, $aria_label)
30  {
31  $this->labeled_actions = $this->toArray($labelled_actions);
32  $this->checkStringArg("string", $aria_label);
33  $this->aria_label = $aria_label;
34  }
35 
36  public function withActive($label)
37  {
38  $this->checkStringArg("label", $label);
39  $clone = clone $this;
40  $clone->active = $label;
41  return $clone;
42  }
43 
44  public function getActive()
45  {
46  return $this->active;
47  }
48 
49  public function getLabelledActions()
50  {
52  }
53 
54  public function getAriaLabel()
55  {
56  return $this->aria_label;
57  }
58 }
trait ComponentHelper
Provides common functionality for component implementations.
checkStringArg($which, $value)
Throw an InvalidArgumentException if $value is no string.
__construct($labelled_actions, $aria_label)
Definition: Mode.php:29
toArray($value)
Wrap the given value in an array if it is no array.