ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ShowOnLoginPage.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
26 use Closure;
27 
28 final class ShowOnLoginPage
29 {
33  public function __construct(
34  private readonly Provide $legal_documents,
35  private readonly UI $ui,
36  private readonly Closure $create_template
37  ) {
38  }
39 
43  public function __invoke(): array
44  {
45  if ($this->legal_documents->document()->repository()->countAll() === 0) {
46  return [];
47  }
48 
49  $template = ($this->create_template)('login_link.html');
50  $template->setVariable('LABEL', htmlentities($this->ui->txt('usr_agreement')));
51  $template->setVariable('HREF', $this->legal_documents->publicPage()->url());
52 
53  return [$this->ui->create()->legacy($template->get())];
54  }
55 }
__construct(private readonly Provide $legal_documents, private readonly UI $ui, private readonly Closure $create_template)