ILIAS  release_7 Revision v7.30-3-g800a261c036
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
16
21{
24
29
34
39
43 protected $entries;
44
45 public function __construct(
46 SignalGeneratorInterface $signal_generator
47 ) {
48 $this->signal_generator = $signal_generator;
49 $this->initSignals();
50 }
51
55 public function getEntries() : array
56 {
57 return $this->entries;
58 }
59
63 public function withAdditionalEntry(string $id, $entry) : MainControls\MetaBar
64 {
65 $classes = [Button\Bulky::class, Link\Bulky::class, Slate::class];
66 $check = [$entry];
67 $this->checkArgListElements("Bulky Button, Bulky Link or Slate", $check, $classes);
68
69 $clone = clone $this;
70 $clone->entries[$id] = $entry;
71 return $clone;
72 }
73
77 public function getEntryClickSignal() : Signal
78 {
79 return $this->entry_click_signal;
80 }
81
85 public function getDisengageAllSignal() : Signal
86 {
87 return $this->disengage_all_signal;
88 }
89
93 protected function initSignals()
94 {
95 $this->entry_click_signal = $this->signal_generator->create();
96 $this->disengage_all_signal = $this->signal_generator->create();
97 }
98
99 public function withClearedEntries() : MainControls\MetaBar
100 {
101 $clone = clone $this;
102 $clone->entries = [];
103 return $clone;
104 }
105}
An exception for terminatinating execution or to throw for unit testing.
__construct(SignalGeneratorInterface $signal_generator)
Definition: MetaBar.php:45
initSignals()
Set the signals for this component.
Definition: MetaBar.php:93
This describes the MetaBar.
Definition: MetaBar.php:15
Prompts are notifications from the system to the user.
Definition: Prompt.php:11
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.