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 Alexander 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 if ($component instanceof Component\Link\Standard) {
21 return $this->renderStandard($component, $default_renderer);
22 }
23 return "";
24 }
25
26 protected function renderStandard(Component\Link\Standard $component, RendererInterface $default_renderer)
27 {
28 $tpl_name = "tpl.standard.html";
29
30 $tpl = $this->getTemplate($tpl_name, true, true);
31 $action = $component->getAction();
32 $label = $component->getLabel();
33 if ($component->getOpenInNewViewport()) {
34 $tpl->touchBlock("open_in_new_viewport");
35 }
36 $tpl->setVariable("LABEL", $label);
37 $tpl->setVariable("HREF", $action);
38
39 return $tpl->get();
40 }
41
45 protected function getComponentInterfaceName()
46 {
47 return array(Component\Link\Standard::class
48 );
49 }
50}
$tpl
Definition: ilias.php:10
An exception for terminatinating execution or to throw for unit testing.
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.
$action
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