ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
RootContent.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
25use ILIAS\MetaData\Editor\Full\Services\Services as FullEditorServices;
28use ILIAS\UI\Factory as UIFactory;
30use ILIAS\UI\Component\Dropdown\Standard as StandardDropdown;
32
34{
35 protected UIFactory $ui_factory;
36 protected FullEditorServices $services;
39
40 public function __construct(
41 FullEditorServices $services,
42 UIFactory $ui_factory,
45 ) {
46 $this->services = $services;
47 $this->ui_factory = $ui_factory;
48 $this->presenter = $presenter;
49 $this->panel_content = $panel_content;
50 }
51
55 public function content(
56 PathInterface $base_path,
57 ElementInterface $element,
59 ): \Generator {
60 yield from $this->createModalsAndDropdown(
61 $base_path,
62 $element,
63 $request
64 );
65
66 $content = [];
67 $content[] = $this->ui_factory->messageBox()->info(
68 $this->presenter->utilities()->txt('meta_full_editor_navigation_info')
69 );
70 foreach ($element->getSubElements() as $sub) {
71 if ($sub->isScaffold()) {
72 continue;
73 }
74 $sub_content = $this->panel_content->content(
75 $base_path,
76 $sub,
77 true,
78 $request
79 );
80 foreach ($sub_content as $type => $entity) {
81 if ($type === ContentType::MAIN) {
82 $content[] = $entity;
83 continue;
84 }
85 yield $type => $entity;
86 }
87 }
88
89 $panel = $this->ui_factory->panel()->standard(
90 $this->presenter->elements()->name($element),
91 $content
92 );
93 yield ContentType::MAIN => $panel;
94 }
95
99 protected function createModalsAndDropdown(
100 PathInterface $base_path,
101 ElementInterface $element,
103 ): \Generator {
104 $buttons = [];
105 foreach ($element->getSubElements() as $sub) {
106 if (!$sub->isScaffold()) {
107 continue;
108 }
109 $create_modal = $this->services->actions()->getModal()->create(
110 $base_path,
111 $sub,
112 $request
113 );
114 $buttons[] = $this->services->actions()->getButton()->create(
115 $create_modal->getFlexibleSignal(),
116 $sub,
117 true
118 );
119 yield ContentType::MODAL => $create_modal;
120 }
121 $dropdown = $this->ui_factory->dropdown()
122 ->standard($buttons)
123 ->withLabel($this->presenter->utilities()->txt('add'));
124 yield ContentType::TOOLBAR => $dropdown;
125 }
126}
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
createModalsAndDropdown(PathInterface $base_path, ElementInterface $element, ?RequestForFormInterface $request)
Definition: RootContent.php:99
content(PathInterface $base_path, ElementInterface $element, ?RequestForFormInterface $request)
Definition: RootContent.php:55
__construct(FullEditorServices $services, UIFactory $ui_factory, PresenterInterface $presenter, PanelContent $panel_content)
Definition: RootContent.php:40
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