ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
RootContent.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use Generator;
28use ILIAS\UI\Factory as UIFactory;
30use ILIAS\UI\Component\Dropdown\Standard as StandardDropdown;
33
35{
36 public function __construct(
37 protected Actions $actions,
38 protected UIFactory $ui_factory,
39 protected PresenterInterface $presenter,
40 protected PanelContent $panel_content
41 ) {
42 }
43
47 public function content(
48 PathInterface $base_path,
49 ElementInterface $element,
51 ): Generator {
52 yield from $this->createModalsAndDropdown(
53 $base_path,
54 $element,
55 $request
56 );
57
58 $content = [];
59 $content[] = $this->ui_factory->messageBox()->info(
60 $this->presenter->utilities()->txt('meta_full_editor_navigation_info')
61 );
62 foreach ($element->getSubElements() as $sub) {
63 if ($sub->isScaffold()) {
64 continue;
65 }
66 $sub_content = $this->panel_content->content(
67 $base_path,
68 $sub,
69 true,
70 $request
71 );
72 foreach ($sub_content as $type => $entity) {
73 if ($type === ContentType::MAIN) {
74 $content[] = $entity;
75 continue;
76 }
77 yield $type => $entity;
78 }
79 }
80
81 $panel = $this->ui_factory->panel()->standard(
82 $this->presenter->elements()->name($element),
83 $content
84 );
85 yield ContentType::MAIN => $panel;
86 }
87
91 protected function createModalsAndDropdown(
92 PathInterface $base_path,
93 ElementInterface $element,
95 ): Generator {
96 $buttons = [];
97 foreach ($element->getSubElements() as $sub) {
98 if (!$sub->isScaffold()) {
99 continue;
100 }
101 $create_modal = $this->actions->getModal()->create(
102 $base_path,
103 $sub,
104 $request
105 );
106 $buttons[] = $this->actions->getButton()->create(
107 $create_modal->getFlexibleSignal(),
108 $sub,
109 true
110 );
111 yield ContentType::MODAL => $create_modal;
112 }
113 $dropdown = $this->ui_factory->dropdown()
114 ->standard($buttons)
115 ->withLabel($this->presenter->utilities()->txt('add'));
116 yield ContentType::TOOLBAR => $dropdown;
117 }
118}
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
createModalsAndDropdown(PathInterface $base_path, ElementInterface $element, ?RequestForFormInterface $request)
Definition: RootContent.php:91
__construct(protected Actions $actions, protected UIFactory $ui_factory, protected PresenterInterface $presenter, protected PanelContent $panel_content)
Definition: RootContent.php:36
content(PathInterface $base_path, ElementInterface $element, ?RequestForFormInterface $request)
Definition: RootContent.php:47
This describes a Standard Dropdown.
Definition: Standard.php:27
This describes how a panel could be modified during construction of UI.
Definition: Panel.php:31