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 
15  public function render(Component\Component $component, RendererInterface $default_renderer) {
16  $this->checkComponent($component);
17  $tpl = $this->getTemplate("tpl.card.html", true, true);
18 
19  if($component->getImage()){
20  $tpl->setVariable("IMAGE",$default_renderer->render($component->getImage(),$default_renderer));
21  }
22 
23  $tpl->setVariable("TITLE",$component->getTitle());
24 
25  if(is_array($component->getSections())){
26  foreach($component->getSections() as $section){
27  $tpl->setCurrentBlock("section");
28  $tpl->setVariable("SECTION",$default_renderer->render($section,$default_renderer));
29  $tpl->parseCurrentBlock();
30  }
31  }
32  return $tpl->get();
33  }
34 
38  protected function getComponentInterfaceName() {
39  return array(Component\Card\Card::class);
40  }
41 }
render(Component\Component $component, RendererInterface $default_renderer)
Definition: Renderer.php:15
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
$section
Definition: Utf8Test.php:83
Create styles array
The data for the language used.
getTemplate($name, $purge_unfilled_vars, $purge_unused_blocks)
Get template of component this renderer is made for.