ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
Renderer.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 2016 Timon Amstutz <timon.amstutz@ilub.unibe.ch> Extended GPL, see docs/LICENSE */
4 
6 
10 
19  public function render(Component\Component $component, RendererInterface $default_renderer) {
23  $this->checkComponent($component);
24  $tpl = $this->getTemplate("tpl.image.html", true, true);
25 
26  $tpl->setCurrentBlock($component->getType());
27  $tpl->setVariable("SOURCE",$component->getSource());
28  $tpl->setVariable("ALT",htmlspecialchars($component->getAlt()));
29  $tpl->parseCurrentBlock();
30 
31  return $tpl->get();
32  }
33 
37  protected function getComponentInterfaceName() {
38  return [Component\Image\Image::class];
39  }
40 }
checkComponent(Component $component)
Check if a given component fits this renderer and throw if that is not the case. ...
global $tpl
Definition: ilias.php:8
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.