ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
DefaultRendererFactory.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 2017 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4
6
8use ILIAS\UI\Factory as RootFactory;
9
11{
15 protected $ui_factory;
16
20 protected $tpl_factory;
21
25 protected $lng;
26
30 protected $js_binding;
31
33 {
34 $this->ui_factory = $ui_factory;
35 $this->tpl_factory = $tpl_factory;
36 $this->lng = $lng;
37 $this->js_binding = $js_binding;
38 }
39
43 public function getRendererInContext(Component $component, array $contexts)
44 {
45 $name = $this->getRendererNameFor($component);
46 $this->lng->loadLanguageModule("ui");
47 return new $name($this->ui_factory, $this->tpl_factory, $this->lng, $this->js_binding);
48 }
49
50
57 protected function getRendererNameFor(Component $component)
58 {
59 $class = get_class($component);
60 $parts = explode("\\", $class);
61 $parts[count($parts) - 1] = "Renderer";
62 $base = implode("\\", $parts);
63 return $base;
64 }
65
69 public function getJSBinding()
70 {
71 return $this->js_binding;
72 }
73}
An exception for terminatinating execution or to throw for unit testing.
getRendererNameFor(Component $component)
Get the name for the renderer of Component class.
__construct(RootFactory $ui_factory, TemplateFactory $tpl_factory, \ilLanguage $lng, JavaScriptBinding $js_binding)
getRendererInContext(Component $component, array $contexts)
@inheritdocs
language handling
A component is the most general form of an entity in the UI.
Definition: Component.php:14
This is how the factory for UI elements looks.
Definition: Factory.php:16
Provides methods to interface with javascript.
This is the interface that components should use if they want to load specific renderers.
Interface for a factory that provides templates.
$base
Definition: index.php:4