ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Renderer.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 2017 Nils Haagen <nils.haagen@concepts.and-training.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 {
21 $this->checkComponent($component);
22 $tpl = $this->getTemplate("tpl.icon.html", true, true);
23
24 $tpl->setVariable("NAME", $component->getName());
25 $tpl->setVariable("ARIA_LABEL", $component->getAriaLabel());
26 $tpl->setVariable("SIZE", $component->getSize());
27
28 if ($component instanceof Component\Icon\Custom) {
29 $tpl->setVariable("CUSTOMIMAGE", $component->getIconPath());
30 } else {
31 if ($component->isOutlined()) {
32 $tpl->setVariable("OUTLINED", " outlined");
33 }
34 }
35
36 $ab = $component->getAbbreviation();
37 if ($ab) {
38 $tpl->setVariable("ABBREVIATION", $ab);
39 }
40
41 $di = $component->isDisabled();
42 if ($di) {
43 $tpl->setVariable("DISABLED", " disabled");
44 }
45
46 return $tpl->get();
47 }
48
52 protected function getComponentInterfaceName()
53 {
54 return array(Component\Icon\Icon::class);
55 }
56}
$tpl
Definition: ilias.php:10
An exception for terminatinating execution or to throw for unit testing.
getComponentInterfaceName()
Get the name of the component-interface this renderer is supposed to render.ATTENTION: Fully qualifie...
Definition: Renderer.php:52
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
render(Component $component, Renderer $default_renderer)
Render the component if possible and delegate additional rendering to the default_renderer.
An entity that renders components to a string output.
Definition: Renderer.php:15