ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
Renderer.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
22 
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 }
Registry for resources required by rendered output like Javascript or CSS.
render(Component\Component $component, RendererInterface $default_renderer)
Definition: Renderer.php:33
checkComponent(Component $component)
Check if a given component fits this renderer and throw if that is not the case. ...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getTemplate(string $name, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get template of component this renderer is made for.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Counter.php:21
register(string $name)
Add a dependency.
registerResources(ResourceRegistry $registry)
Announce resources this renderer requires.
Definition: Renderer.php:50
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41