ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 
9 
11 {
15  private $ui_factory;
16 
20  private $tpl_factory;
21 
25  private $lng;
26 
30  private $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  return new $name($this->ui_factory, $this->tpl_factory, $this->lng, $this->js_binding);
47  }
48 
49 
56  protected function getRendererNameFor(Component $component)
57  {
58  $class = get_class($component);
59  $parts = explode("\\", $class);
60  $parts[count($parts)-1] = "Renderer";
61  $base = implode("\\", $parts);
62  return $base;
63  }
64 
68  public function getJSBinding()
69  {
70  return $this->js_binding;
71  }
72 }
$base
Definition: index.php:4
if($format !==null) $name
Definition: metadata.php:146
getRendererNameFor(Component $component)
Get the name for the renderer of Component class.
Provides methods to interface with javascript.
Create styles array
The data for the language used.
This is the interface that components should use if they want to load specific renderers.
__construct(RootFactory $ui_factory, TemplateFactory $tpl_factory, \ilLanguage $lng, JavaScriptBinding $js_binding)
getRendererInContext(Component $component, array $contexts)
language handling
Interface for a factory that provides templates.