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 Alexander 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  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 }
$action
checkComponent(Component $component)
Check if a given component fits this renderer and throw if that is not the case. ...
$tpl
Definition: ilias.php:10
getTemplate($name, $purge_unfilled_vars, $purge_unused_blocks)
Get template of component this renderer is made for.