ILIAS  release_8 Revision v8.24
Renderer.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
22
24use ILIAS\UI\Renderer as RendererInterface;
26
28{
32 public function render(Component\Component $component, RendererInterface $default_renderer): string
33 {
34 $this->checkComponent($component);
35
36 if ($component instanceof Component\Divider\Horizontal) {
37 return $this->renderDividerHorizontal($component);
38 }
39 if ($component instanceof Component\Divider\Vertical) {
40 return $this->renderDividerVertical();
41 }
42 return "";
43 }
44
45 protected function renderDividerHorizontal(Component\Divider\Horizontal $component): string
46 {
47 $tpl = $this->getTemplate("tpl.horizontal.html", true, true);
48
49 $label = $component->getLabel();
50
51 if ($label !== null) {
52 $tpl->setCurrentBlock("label");
53 $tpl->setVariable("LABEL", $label);
54 $tpl->parseCurrentBlock();
55 $tpl->touchBlock("with_label");
56 } else {
57 $tpl->touchBlock("divider");
58 }
59
60 return $tpl->get();
61 }
62
63 protected function renderDividerVertical(): string
64 {
65 $tpl = $this->getTemplate("tpl.vertical.html", true, true);
66
67 $tpl->touchBlock("divider");
68
69 return $tpl->get();
70 }
71
75 protected function getComponentInterfaceName(): array
76 {
77 return [
78 Component\Divider\Horizontal::class,
79 Component\Divider\Vertical::class
80 ];
81 }
82}
renderDividerHorizontal(Component\Divider\Horizontal $component)
Definition: Renderer.php:45
getComponentInterfaceName()
Get the name of the component-interface this renderer is supposed to render.ATTENTION: Fully qualifie...
Definition: Renderer.php:75
render(Component\Component $component, RendererInterface $default_renderer)
Definition: Renderer.php:32
checkComponent(Component $component)
Check if a given component fits this renderer and throw \LogicError if that is not the case.
getTemplate(string $name, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get template of component this renderer is made for.
An entity that renders components to a string output.
Definition: Renderer.php:31
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Factory.php:21