ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ShowOnLoginPage.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
26use Closure;
27use ilTemplate;
28
29final class ShowOnLoginPage
30{
34 public function __construct(
35 private readonly Provide $legal_documents,
36 private readonly UI $ui,
37 private readonly Closure $create_template
38 ) {
39 }
40
44 public function __invoke(): array
45 {
46 if ($this->legal_documents->document()->repository()->countAll() === 0) {
47 return [];
48 }
49
50 $template = ($this->create_template)('login_link.html');
51 $template->setVariable('LABEL', htmlentities($this->ui->txt('usr_agreement')));
52 $template->setVariable('HREF', $this->legal_documents->publicPage()->url());
53
54 return [$this->ui->create()->legacy()->content($template->get())];
55 }
56}
__construct(private readonly Provide $legal_documents, private readonly UI $ui, private readonly Closure $create_template)
special template class to simplify handling of ITX/PEAR
A component is the most general form of an entity in the UI.
Definition: Component.php:28