ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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 
42 
43  public function __construct(
50  ) {
51  $this->ui_factory = $ui_factory;
52  $this->tpl_factory = $tpl_factory;
53  $this->lng = $lng;
54  $this->js_binding = $js_binding;
55  $this->refinery = $refinery;
56  $this->image_path_resolver = $image_path_resolver;
57  }
58 
62  public function getRendererInContext(Component $component, array $contexts)
63  {
64  $name = $this->getRendererNameFor($component);
65  return new $name(
66  $this->ui_factory,
67  $this->tpl_factory,
68  $this->lng,
69  $this->js_binding,
70  $this->refinery,
71  $this->image_path_resolver
72  );
73  }
74 
75 
82  protected function getRendererNameFor(Component $component)
83  {
84  $class = get_class($component);
85  $parts = explode("\\", $class);
86  $parts[count($parts) - 1] = "Renderer";
87  $base = implode("\\", $parts);
88  return $base;
89  }
90 
94  public function getJSBinding()
95  {
96  return $this->js_binding;
97  }
98 }
Some Components need to resolve pathes to image-files.
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)
Interface for a factory that provides templates.
__construct(RootFactory $ui_factory, TemplateFactory $tpl_factory, \ilLanguage $lng, JavaScriptBinding $js_binding, Refinery $refinery, ImagePathResolver $image_path_resolver)
$base
Definition: index.php:4