ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
ButtonRendererFactory.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24use ILIAS\UI\Component\Button\Button as ButtonComponent;
27
32{
40 'StandardViewControlContainerInput',
41 'StandardFilterContainerInput',
42 'StandardFormContainerInput',
43 ];
44
45 public function getRendererInContext(Component $component, array $contexts): ComponentRenderer
46 {
47 if ($this->isIndirectInputContainerContext($contexts)) {
49 $this->ui_factory,
50 $this->tpl_factory,
51 $this->lng,
52 $this->js_binding,
53 $this->image_path_resolver,
54 $this->data_factory,
55 $this->help_text_retriever,
56 $this->upload_limit_resolver,
57 );
58 }
59 return parent::getRendererInContext($component, $contexts);
60 }
61
65 protected function isIndirectInputContainerContext(array $contexts_asc): bool
66 {
67 // ensure minimum context size allowing indirect descendants
68 $context_size = count($contexts_asc);
69 if (3 > $context_size) {
70 return false;
71 }
72 // check if button is direct descendant
73 $direct_ancestor = $contexts_asc[$context_size - 2];
74 if (in_array($direct_ancestor, self::USE_FORM_CONTEXT_RENDERER_FOR_INDIRECT_DESCENDANTS_OF, true)) {
75 return false;
76 }
77 // check if button is indirect descendant
78 $indirect_ancestors = array_splice($contexts_asc, 0, -2);
79 return (0 < count(array_intersect($indirect_ancestors, self::USE_FORM_CONTEXT_RENDERER_FOR_INDIRECT_DESCENDANTS_OF)));
80 }
81}
getRendererInContext(Component $component, array $contexts)
@inheritdocs
const array USE_FORM_CONTEXT_RENDERER_FOR_INDIRECT_DESCENDANTS_OF
Allthough there are various Input Containers, only the ones listed below are actually rendered.
Button components which are indirect descendants of an Input Container component MUST be rendered wit...
This describes commonalities between standard and primary buttons.
Definition: Button.php:34
A component is the most general form of an entity in the UI.
Definition: Component.php:28
An entity that renders components to a string output.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21