ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
FooterRendererFactory.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
31
36{
41
42 public function __construct(private readonly UIServices $ui)
43 {
44 $this->group_renderer = new GroupItemRenderer($this->ui, $this);
45 $this->link_renderer = new LinkItemRenderer($this->ui);
46 $this->modal_renderer = new ModalItemRenderer($this->ui);
47 $this->null_renderer = new NullItemRenderer($this->ui);
48 }
49
51 {
52 return match (true) {
53 $item instanceof Group => $this->group_renderer,
54 $item instanceof Link => $this->link_renderer,
55 $item instanceof Modal => $this->modal_renderer,
56 default => $this->null_renderer,
57 };
58 }
59
60 public function addToFooter(isItem $item, Footer $footer): Footer
61 {
62 $renderer = $this->getRendererFor($item);
63 $component = $renderer->getComponentForItem($item);
64
65 return match (true) {
66 $item instanceof Group => $footer->withAdditionalLinkGroup($item->getTitle(), $component),
67 $item instanceof Link => $item->hasParent() ? $footer : $footer->withAdditionalLink($component),
68 $item instanceof Modal => $footer->withAdditionalModal($item->getModal()),
69 $item instanceof Permanent => $footer->withPermanentURL($item->getURI()),
70 $item instanceof Text => $footer->withAdditionalText($item->getText()),
71 default => $footer,
72 };
73 }
74
75}
$renderer
Provides fluid interface to RBAC services.
Definition: UIServices.php:25
withPermanentURL(URI $url)
Get a Footer like this but with a permanent URL to the current page, which can be copied by the users...
withAdditionalLinkGroup(string $title, array $actions)
Get a Footer like this but add an additional, named group of links or shy-buttons to the link-group s...
withAdditionalLink(Link|Shy ... $actions)
Get a Footer like this but add an additional link or shy-button to the links section.
withAdditionalText(string ... $texts)
Get a Footer like this but add additional text information to the meta section.
withAdditionalModal(Modal\RoundTrip $modal)