ILIAS  release_7 Revision v7.30-3-g800a261c036
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
7use ILIAS\Refinery\Factory as Refinery;
9use ILIAS\UI\Factory as RootFactory;
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(
44 RootFactory $ui_factory,
48 Refinery $refinery,
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}
An exception for terminatinating execution or to throw for unit testing.
Builds data types.
Definition: Factory.php:20
__construct(RootFactory $ui_factory, TemplateFactory $tpl_factory, \ilLanguage $lng, JavaScriptBinding $js_binding, Refinery $refinery, ImagePathResolver $image_path_resolver)
getRendererNameFor(Component $component)
Get the name for the renderer of Component class.
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:18
Some Components need to resolve pathes to image-files.
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.
if($format !==null) $name
Definition: metadata.php:230
$base
Definition: index.php:4