ILIAS  release_7 Revision v7.30-3-g800a261c036
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
8use ILIAS\UI\Renderer as RendererInterface;
10
12{
16 public function render(Component\Component $component, RendererInterface $default_renderer)
17 {
18 $tpl_card = $this->getTemplate("tpl.deck_card.html", true, true);
19 $tpl_row = $this->getTemplate("tpl.deck_row.html", true, true);
20
21 foreach ($component->getCards() as $card) {
22 $tpl_card->setCurrentBlock("card");
23 $tpl_card->setVariable("CARD", $default_renderer->render($card));
24 $tpl_card->setVariable("SIZE_MD", $component->getCardsSizeForDisplaySize(Deck::SIZE_M));
25 $tpl_card->setVariable("SIZE_SM", $component->getCardsSizeForDisplaySize(Deck::SIZE_S));
26 $tpl_card->setVariable("SIZE_XS", $component->getCardsSizeForDisplaySize(Deck::SIZE_XS));
27 $tpl_card->setVariable("SIZE_LG", $component->getCardsSizeForDisplaySize(Deck::SIZE_L));
28 $tpl_card->parseCurrentBlock();
29 }
30
31 $this->parseRow($tpl_row, $tpl_card->get());
32
33 return $tpl_row->get();
34 }
35
36 protected function parseRow($tpl_row, $content)
37 {
38 $tpl_row->setCurrentBlock("row");
39 $tpl_row->setVariable("CARDS", $content);
40 $tpl_row->parseCurrentBlock();
41 }
42
46 protected function getComponentInterfaceName()
47 {
48 return array(Component\Deck\Deck::class);
49 }
50}
An exception for terminatinating execution or to throw for unit testing.
render(Component\Component $component, RendererInterface $default_renderer)
@inheritdocs
Definition: Renderer.php:16
getTemplate($name, $purge_unfilled_vars, $purge_unused_blocks)
Get template of component this renderer is made for.
A component is the most general form of an entity in the UI.
Definition: Component.php:14
An entity that renders components to a string output.
Definition: Renderer.php:15