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 
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 }
checkComponent(Component $component)
Check if a given component fits this renderer and throw if that is not the case. ...
$tpl
Definition: ilias.php:10
render(Component\Component $component, RendererInterface $default_renderer)
Definition: Renderer.php:16
Create styles array
The data for the language used.
renderDivider(Component\Divider\Horizontal $component, RendererInterface $default_renderer)
Definition: Renderer.php:23
getTemplate($name, $purge_unfilled_vars, $purge_unused_blocks)
Get template of component this renderer is made for.