19 declare(strict_types=1);
64 $registry->
register(
'./src/UI/templates/js/Core/dist/core.js');
74 return $this->ui_factory;
79 return $this->data_factory;
89 return $this->upload_limit_resolver;
95 final public function txt(
string $id): string
97 return $this->
lng->txt($id);
114 return $this->
lng->getLangKey();
119 return $this->js_binding;
130 final protected function getTemplate(
string $name,
bool $purge_unfilled_vars,
bool $purge_unused_blocks):
Template 142 return "src/UI/templates/default/$component/$name";
150 return $this->tpl_factory->getTemplate($path, $purge_unfilled_vars, $purge_unused_blocks);
181 return $this->js_binding->createId();
190 if ($binder === null) {
194 $id = $this->js_binding->createId();
195 $on_load_code = $binder(
$id);
196 if (!is_string($on_load_code)) {
198 "Expected JavaScript binder to return string" .
199 " (used component: " . get_class($component) .
")" 202 $this->js_binding->addOnLoadCode($on_load_code);
212 if (count($triggered_signals) == 0) {
217 foreach ($triggered_signals as $triggered_signal) {
218 $signal = $triggered_signal->getSignal();
219 $event = $triggered_signal->getEvent();
220 $options = json_encode($signal->getOptions());
223 if ($event ==
'load' || $event ==
'ready') {
225 "$(document).trigger('$signal', 227 'id' : '$signal', 'event' : '$event', 228 'triggerer' : $('#$id'), 229 'options' : JSON.parse('$options') 234 "$('#$id').on('$event', function(event) { 235 $(this).trigger('$signal', 237 'id' : '$signal', 'event' : '$event', 238 'triggerer' : $(this), 239 'options' : JSON.parse('$options') 259 if (!is_array($interfaces)) {
261 "Expected array, found '" . (
string) (null) .
"' when rendering." 265 foreach ($interfaces as $interface) {
266 if ($component instanceof $interface) {
270 $ifs = implode(
", ", $interfaces);
272 "Expected $ifs, found '" . get_class($component) .
"' when rendering." 290 $class = get_class($this);
291 if (isset(self::$component_storage[$class])) {
292 return self::$component_storage[$class];
296 $re =
"%ILIAS\\\\UI\\\\Implementation\\\\Component\\\\(\\w+)\\\\(\\w+)%";
297 preg_match($re, $class, $matches);
298 if (preg_match($re, $class, $matches) !== 1) {
299 throw new LogicException(
"The Renderer needs to be located in ILIAS\\UI\\Implementation\\Component\\*.");
301 self::$component_storage[$class] = $matches[1];
303 return self::$component_storage[$class];
308 return $this->image_path_resolver;
313 return $this->help_text_retriever->getHelpText($purpose, ...$topics);
323 if ($this->tooltip_renderer === null) {
334 return htmlspecialchars($value, ENT_QUOTES | ENT_SUBSTITUTE,
'utf-8');
Registry for resources required by rendered output like Javascript or CSS.
getTemplateRaw(string $path, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get a template from any path.
addTriggererOnLoadCode(Triggerer $triggerer)
Add onload-code for triggerer.
This is just a class that marks a string as a help topic.
checkComponent(Component $component)
Check if a given component fits this renderer and throw if that is not the case. ...
__construct(private Factory $ui_factory, private TemplateFactory $tpl_factory, private ilLanguage $lng, private JavaScriptBinding $js_binding, private \ILIAS\Refinery\Factory $refinery, private ImagePathResolver $image_path_resolver, private DataFactory $data_factory, private HelpTextRetriever $help_text_retriever, private UploadLimitResolver $upload_limit_resolver,)
Class ChatMainBarProvider .
An entity that renders components to a string output.
TooltipRenderer $tooltip_renderer
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.
convertSpecialCharacters(string $value)
txt(string $id)
Get a text from the language file.
Some Components need to resolve pathes to image-files.
static array $component_storage
toJS($key)
Add language var to client side (il.Language)
bindOnloadCode(JavaScriptBindable $component)
Bind the JavaScript onload-code.
createId()
Get a fresh unique id.
A purpose describes the intended use for a certain help text.
This describes a facility that the UI framework can use to retrieve some help text.
getComponentInterfaceName()
Get the name of the component-interface this renderer is supposed to render.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getTemplate(string $name, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get template of component this renderer is made for.
getOnLoadCode()
Get the currently bound on load code.
Provides methods to interface with javascript.
register(string $name)
Add a dependency.
getTriggeredSignals()
Get all triggered signals of this component.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
getLangKey()
Get current language key.
getUIFactory()
Get a UI factory.
withAdditionalOnLoadCode(Closure $binder)
Add some onload-code to the component instead of replacing the existing one.
registerResources(ResourceRegistry $registry)
Announce resources this renderer requires.
Interface for a factory that provides templates.
Base class for all component renderers.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getHelpText(Help\Purpose $purpose, Help\Topic ... $topics)
bindJavaScript(JavaScriptBindable $component)
Bind the component to JavaScript.
Refinery Factory $refinery
getTemplatePath(string $name)
Get the path to the template of this component.