ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 
10 
12 {
16  protected $ui_factory;
17 
21  protected $tpl_factory;
22 
26  protected $lng;
27 
31  protected $js_binding;
32 
36  protected $refinery;
37 
38  public function __construct(
44  ) {
45  $this->ui_factory = $ui_factory;
46  $this->tpl_factory = $tpl_factory;
47  $this->lng = $lng;
48  $this->js_binding = $js_binding;
49  $this->refinery = $refinery;
50  }
51 
55  public function getRendererInContext(Component $component, array $contexts)
56  {
57  $name = $this->getRendererNameFor($component);
58  return new $name(
59  $this->ui_factory,
60  $this->tpl_factory,
61  $this->lng,
62  $this->js_binding,
63  $this->refinery
64  );
65  }
66 
67 
74  protected function getRendererNameFor(Component $component)
75  {
76  $class = get_class($component);
77  $parts = explode("\\", $class);
78  $parts[count($parts) - 1] = "Renderer";
79  $base = implode("\\", $parts);
80  return $base;
81  }
82 
86  public function getJSBinding()
87  {
88  return $this->js_binding;
89  }
90 }
$base
Definition: index.php:4
if($format !==null) $name
Definition: metadata.php:230
getRendererNameFor(Component $component)
Get the name for the renderer of Component class.
Provides methods to interface with javascript.
This is the interface that components should use if they want to load specific renderers.
getRendererInContext(Component $component, array $contexts)
__construct(RootFactory $ui_factory, TemplateFactory $tpl_factory, \ilLanguage $lng, JavaScriptBinding $js_binding, Refinery $refinery)
language handling
Interface for a factory that provides templates.