ILIAS  release_8 Revision v8.24
Renderer.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
22
24use ILIAS\UI\Renderer as RendererInterface;
27
29{
33 public function render(Component\Component $component, RendererInterface $default_renderer): string
34 {
35 $this->checkComponent($component);
36
37 $tpl = $this->getTemplate("tpl.counter.html", true, true);
38 if ($component->getNumber() === 0) {
39 $tpl->touchBlock("hidden_" . $component->getType());
40 }
41 $tpl->setCurrentBlock($component->getType());
42 $tpl->setVariable("NUMBER", $component->getNumber());
43 $tpl->parseCurrentBlock();
44 return $tpl->get();
45 }
46
50 public function registerResources(ResourceRegistry $registry): void
51 {
52 parent::registerResources($registry);
53 $registry->register('./src/UI/templates/js/Counter/dist/counter.js');
54 }
55
59 protected function getComponentInterfaceName(): array
60 {
61 return array(Component\Counter\Counter::class);
62 }
63}
render(Component\Component $component, RendererInterface $default_renderer)
@inheritdocs
Definition: Renderer.php:33
registerResources(ResourceRegistry $registry)
Announce resources this renderer requires.
Definition: Renderer.php:50
checkComponent(Component $component)
Check if a given component fits this renderer and throw \LogicError if that is not the case.
getTemplate(string $name, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get template of component this renderer is made for.
Registry for resources required by rendered output like Javascript or CSS.
register(string $name)
Add a dependency.
An entity that renders components to a string output.
Definition: Renderer.php:31
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Counter.php:21