ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
FooterProvider.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
30 use Closure;
33 
35 {
36  private readonly Id $parent_id;
37  private readonly Conductor $ldoc;
38 
39  public function __construct(Container $dic)
40  {
41  parent::__construct($dic);
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  return $obj instanceof Modal ?
72  $this->item_factory->modal($this->id_factory->identifier($id), $title, $obj)->withParent($this->parent_id) :
73  $this->item_factory->link($this->id_factory->identifier($id), $title)->withAction($obj);
74  }
75 }
This describes commonalities between the different modals.
Definition: Modal.php:34
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
withParent(IdentificationInterface $identification)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
__construct(Container $dic, ilPlugin $plugin)
item(string $id, string $title, object $obj)
$dic
Definition: result.php:31