ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Renderer.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 2017 Alex Killing <killing@leifos.de> Extended GPL, see docs/LICENSE */
4
6
8use ILIAS\UI\Renderer as RendererInterface;
10
12{
16 public function render(Component\Component $component, RendererInterface $default_renderer)
17 {
18 $this->checkComponent($component);
19
20 return $this->renderDivider($component, $default_renderer);
21 }
22
23 protected function renderDivider(Component\Divider\Horizontal $component, RendererInterface $default_renderer)
24 {
25 $tpl = $this->getTemplate("tpl.horizontal.html", true, true);
26
27 $label = $component->getLabel();
28
29 if ($label !== null) {
30 $tpl->setCurrentBlock("label");
31 $tpl->setVariable("LABEL", $label);
32 $tpl->parseCurrentBlock();
33 $tpl->touchBlock("with_label");
34 } else {
35 $tpl->touchBlock("divider");
36 }
37
38 return $tpl->get();
39 }
40
44 protected function getComponentInterfaceName()
45 {
46 return array(Component\Divider\Horizontal::class
47 );
48 }
49}
$tpl
Definition: ilias.php:10
An exception for terminatinating execution or to throw for unit testing.
renderDivider(Component\Divider\Horizontal $component, RendererInterface $default_renderer)
Definition: Renderer.php:23
getComponentInterfaceName()
Get the name of the component-interface this renderer is supposed to render.ATTENTION: Fully qualifie...
Definition: Renderer.php:44
render(Component\Component $component, RendererInterface $default_renderer)
Definition: Renderer.php:16
getTemplate($name, $purge_unfilled_vars, $purge_unused_blocks)
Get template of component this renderer is made for.
checkComponent(Component $component)
Check if a given component fits this renderer and throw \LogicError if that is not the case.
A component is the most general form of an entity in the UI.
Definition: Component.php:14
An entity that renders components to a string output.
Definition: Renderer.php:15