ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
FooterProvider.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
27use ILIAS\UI\Factory as UIFactory;
31use Closure;
34
36{
37 private readonly Id $parent_id;
38 private readonly Conductor $ldoc;
39
40 public function __construct(Container $dic)
41 {
43 $this->parent_id = (new ilFooterStandardGroupsProvider($dic))->getIdentificationFor(ilFooterStandardGroups::LEGAL_INFORMATION);
44 $this->ldoc = $dic['legalDocuments'];
45 }
46
47 public function getGroups(): array
48 {
49 return [];
50 }
51
52 public function getEntries(): array
53 {
54 return array_map(
55 fn(array $args) => $this->item(...$args),
56 $this->ldoc->modifyFooter($this->collect([]))()
57 );
58 }
59
60 private function collect(array $items): Closure
61 {
62 return function (...$args) use ($items) {
63 if ($args === []) {
64 return $items;
65 }
66 return $this->collect(array_merge($items, [$args]));
67 };
68 }
69
70 private function item(string $id, string $title, ?object $obj): isItem
71 {
72 $false = fn() => false;
73 $id = $this->id_factory->identifier($id);
74
75 $item = match (true) {
76 $obj === null => $this->item_factory->link($id, $title)
77 ->withAction(new URI(ILIAS_HTTP_PATH))
78 ->withAvailableCallable($false)
79 ->withVisibilityCallable($false),
80 $obj instanceof Modal => $this->item_factory->modal($id, $title, $obj),
81 default => $this->item_factory->link($id, $title)->withAction($obj),
82 };
83
84 return $item->withParent($this->parent_id);
85 }
86}
$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
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35
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