ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Renderer.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24use ILIAS\UI\Renderer as RendererInterface;
29
31{
35 public function render(Component\Component $component, RendererInterface $default_renderer): string
36 {
37 switch(true) {
38 case ($component instanceof Component\Layout\Alignment\Vertical):
39 return $this->renderAlignment($component, $default_renderer);
40
41 default:
42 $this->cannotHandleComponent($component);
43 }
44 }
45
46 protected function renderAlignment(
47 I\Vertical $component,
48 RendererInterface $default_renderer
49 ): string {
50 $tpl = $this->getTemplate('tpl.alignment.html', true, true);
51 foreach ($component->getBlocks() as $idx => $block) {
52 $tpl->setCurrentBlock('block');
53 $tpl->setVariable('CONTENT', $default_renderer->render($block));
54 $tpl->parseCurrentBlock();
55 }
56 $tpl->touchBlock('alignment_vertical');
57 return $tpl->get();
58 }
59}
renderAlignment(I\Vertical $component, RendererInterface $default_renderer)
Definition: Renderer.php:46
render(Component\Component $component, RendererInterface $default_renderer)
Definition: Renderer.php:35
cannotHandleComponent(Component $component)
This method MUST be called by derived component renderers, if.
getTemplate(string $name, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get template of component this renderer is made for.
return true
Registry for resources required by rendered output like Javascript or CSS.
Interface to templating as it is used in the UI framework.
Definition: Template.php:29
An entity that renders components to a string output.
Definition: Renderer.php:31