ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
MetaBar.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 2018 Nils Haagen <nils.haagen@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4
6
14
19{
22
27
32
37
41 protected $entries;
42
43 public function __construct(
44 SignalGeneratorInterface $signal_generator
45 ) {
46 $this->signal_generator = $signal_generator;
47 $this->initSignals();
48 }
49
53 public function getEntries() : array
54 {
55 return $this->entries;
56 }
57
61 public function withAdditionalEntry(string $id, $entry) : MainControls\MetaBar
62 {
63 $classes = [Bulky::class, Slate::class];
64 $check = [$entry];
65 $this->checkArgListElements("Bulky or Slate", $check, $classes);
66
67 $clone = clone $this;
68 $clone->entries[$id] = $entry;
69 return $clone;
70 }
71
75 public function getEntryClickSignal() : Signal
76 {
77 return $this->entry_click_signal;
78 }
79
83 public function getDisengageAllSignal() : Signal
84 {
85 return $this->disengage_all_signal;
86 }
87
91 protected function initSignals()
92 {
93 $this->entry_click_signal = $this->signal_generator->create();
94 $this->disengage_all_signal = $this->signal_generator->create();
95 }
96
97 public function withClearedEntries() : MainControls\MetaBar
98 {
99 $clone = clone $this;
100 $clone->entries = [];
101 return $clone;
102 }
103}
An exception for terminatinating execution or to throw for unit testing.
__construct(SignalGeneratorInterface $signal_generator)
Definition: MetaBar.php:43
initSignals()
Set the signals for this component.
Definition: MetaBar.php:91
This describes a bulky button.
Definition: Bulky.php:10
This describes the MetaBar.
Definition: MetaBar.php:15
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.
checkArgListElements($which, array &$values, $classes)
Check every element of the list if it is an instance of one of the given classes.
trait ComponentHelper
Provides common functionality for component implementations.