ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
PageContent.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
27 
28 class PageContent implements PageFragment
29 {
33  public function __construct(private readonly string $title, private readonly array $components)
34  {
35  }
36 
37  public function render(ilGlobalTemplateInterface $main_template, Renderer $renderer): string
38  {
39  $main_template->setTitle($this->title);
40  return $renderer->render($this->components);
41  }
42 
43  public function withOnScreenMessage(string $type, string $txt, bool $keep = false): PageFragment
44  {
45  return new ShowOnScreenMessage($this, $type, $txt, $keep);
46  }
47 }
An entity that renders components to a string output.
Definition: Renderer.php:30
render($component, ?Renderer $root=null)
Render given component.
render(ilGlobalTemplateInterface $main_template, Renderer $renderer)
Definition: PageContent.php:37
setTitle(string $a_title, bool $hidden=false)
Sets title in standard template.
$txt
Definition: error.php:14
__construct(private readonly string $title, private readonly array $components)
Definition: PageContent.php:33
withOnScreenMessage(string $type, string $txt, bool $keep=false)
Definition: PageContent.php:43