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 Nils Haagen <nils.haagen@concepts.and-training.de> Extended GPL, see docs/LICENSE */
4 
6 
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  }
31 
32  $ab = $component->getAbbreviation();
33  if ($ab) {
34  $tpl->setVariable("ABBREVIATION", $ab);
35  }
36 
37  return $tpl->get();
38  }
39 
43  protected function getComponentInterfaceName()
44  {
45  return array(Component\Icon\Icon::class);
46  }
47 }
checkComponent(Component $component)
Check if a given component fits this renderer and throw if that is not the case. ...
$tpl
Definition: ilias.php:10
Create styles array
The data for the language used.
render(Component $component, Renderer $default_renderer)
Render the component if possible and delegate additional rendering to the default_renderer.
getTemplate($name, $purge_unfilled_vars, $purge_unused_blocks)
Get template of component this renderer is made for.