ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
Combined.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
5/* Copyright (c) 2018 Nils Haagen <nils.haagen@concepts-and-training.de> Extended GPL, see docs/LICENSE */
6
8
11use ILIAS\UI\Component\Button\Bulky as IBulkyButton;
12use ILIAS\UI\Component\Link\Bulky as IBulkyLink;
14
18class Combined extends Slate implements ISlate\Combined
19{
20 const ENTRY_ACTION_TRIGGER = 'trigger';
21
25 protected $contents = [];
26
30 public function withAdditionalEntry($entry) : ISlate\Combined
31 {
32 $classes = [
33 IBulkyButton::class,
34 IBulkyLink::class,
35 ISlate\Slate::class,
36 Horizontal::class
37 ];
38 $check = [$entry];
39 $this->checkArgListElements("Slate, Bulky -Button or -Link", $check, $classes);
40
41 $clone = clone $this;
42 $clone->contents[] = $entry;
43 return $clone;
44 }
45
49 public function getContents() : array
50 {
51 return $this->contents;
52 }
53
54
55 public function getTriggerSignal(string $entry_id) : Signal
56 {
57 $signal = $this->signal_generator->create();
58 $signal->addOption('entry_id', $entry_id);
59 $signal->addOption('action', self::ENTRY_ACTION_TRIGGER);
60 $this->trigger_signals[] = $signal;
61 return $signal;
62 }
63
64 public function withMappedSubNodes(callable $f)
65 {
66 $clone = clone $this;
67 $new_contents = [];
68 foreach ($clone->getContents() as $k => $v) {
69 $new_contents[$k] = $f($k, $v);
70 }
71 $clone->contents = $new_contents;
72 return $clone;
73 }
74}
An exception for terminatinating execution or to throw for unit testing.
This describes a bulky button.
Definition: Bulky.php:10
checkArgListElements($which, array &$values, $classes)
Check every element of the list if it is an instance of one of the given classes.