ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
FooterProvider.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
26use ILIAS\UI\Factory as UIFactory;
30use Closure;
33
35{
36 private readonly Id $parent_id;
37 private readonly Conductor $ldoc;
38
39 public function __construct(Container $dic)
40 {
42 $this->parent_id = (new ilFooterStandardGroupsProvider($dic))->getIdentificationFor(ilFooterStandardGroups::LEGAL_INFORMATION);
43 $this->ldoc = $dic['legalDocuments'];
44 }
45
46 public function getGroups(): array
47 {
48 return [];
49 }
50
51 public function getEntries(): array
52 {
53 return array_map(
54 fn(array $args) => $this->item(...$args),
55 $this->ldoc->modifyFooter($this->collect([]))()
56 );
57 }
58
59 private function collect(array $items): Closure
60 {
61 return function (...$args) use ($items) {
62 if ($args === []) {
63 return $items;
64 }
65 return $this->collect(array_merge($items, [$args]));
66 };
67 }
68
69 private function item(string $id, string $title, object $obj): isItem
70 {
71 $id = $this->id_factory->identifier($id);
72 $item = $obj instanceof Modal ?
73 $this->item_factory->modal($id, $title, $obj) :
74 $this->item_factory->link($id, $title)->withAction($obj);
75
76 return $item->withParent($this->parent_id);
77 }
78}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
item(string $id, string $title, object $obj)
This describes commonalities between the different modals.
Definition: Modal.php:35
$dic
Definition: ltiresult.php:33
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc