ILIAS  release_8 Revision v8.24
DefaultRendererFactory.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use ILIAS\Data\Factory as DataFactory;
24use ILIAS\Refinery\Factory as Refinery;
26use ILIAS\UI\Factory as RootFactory;
27use ilLanguage;
28
30{
31 protected RootFactory $ui_factory;
33 protected ilLanguage $lng;
35 protected Refinery $refinery;
37 protected DataFactory $data_factory;
38
39 public function __construct(
40 RootFactory $ui_factory,
44 Refinery $refinery,
46 DataFactory $data_factory
47 ) {
48 $this->ui_factory = $ui_factory;
49 $this->tpl_factory = $tpl_factory;
50 $this->lng = $lng;
51 $this->js_binding = $js_binding;
52 $this->refinery = $refinery;
53 $this->image_path_resolver = $image_path_resolver;
54 $this->data_factory = $data_factory;
55 }
56
60 public function getRendererInContext(Component $component, array $contexts): ComponentRenderer
61 {
62 $name = $this->getRendererNameFor($component);
63 return new $name(
64 $this->ui_factory,
65 $this->tpl_factory,
66 $this->lng,
67 $this->js_binding,
68 $this->refinery,
69 $this->image_path_resolver,
70 $this->data_factory
71 );
72 }
73
77 protected function getRendererNameFor(Component $component): string
78 {
79 $class = get_class($component);
80 $parts = explode("\\", $class);
81 $parts[count($parts) - 1] = "Renderer";
82 return implode("\\", $parts);
83 }
84
89 {
90 return $this->js_binding;
91 }
92}
Builds data types.
Definition: Factory.php:21
getRendererNameFor(Component $component)
Get the name for the renderer of Component class.
__construct(RootFactory $ui_factory, TemplateFactory $tpl_factory, ilLanguage $lng, JavaScriptBinding $js_binding, Refinery $refinery, ImagePathResolver $image_path_resolver, DataFactory $data_factory)
getRendererInContext(Component $component, array $contexts)
@inheritdocs
language handling
A component is the most general form of an entity in the UI.
Definition: Component.php:28
This is how the factory for UI elements looks.
Definition: Factory.php:38
An entity that renders components to a string output.
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($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:64
if($format !==null) $name
Definition: metadata.php:247
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...