ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
TableContent.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
26use ILIAS\MetaData\Editor\Full\Services\Services as FullEditorServices;
30
32{
33 protected FullEditorServices $services;
34
35 public function __construct(
36 FullEditorServices $services
37 ) {
38 $this->services = $services;
39 }
40
44 public function content(
45 PathInterface $base_path,
47 ElementInterface ...$elements
48 ): \Generator {
49 yield from $this->createModalAndButton(
50 $base_path,
51 $request,
52 ...$elements
53 );
54 $builder = $this->services->tableFactory()->table();
55 $delete_buttons = [];
56 $update_buttons = [];
57 foreach ($elements as $element) {
58 if ($element->isScaffold()) {
59 continue;
60 }
61 $update_modal = $this->services->actions()->getModal()->update(
62 $base_path,
63 $element,
64 $request
65 );
66 $delete_modal = $this->services->actions()->getModal()->delete(
67 $base_path,
68 $element,
69 true
70 );
71 $builder = $builder->withAdditionalRow(
72 $element,
73 $update_modal->getFlexibleSignal(),
74 $delete_modal?->getFlexibleSignal()
75 );
76 yield ContentType::MODAL => $update_modal;
77 if (isset($delete_modal)) {
78 yield ContentType::MODAL => $delete_modal;
79 }
80 }
81 yield ContentType::MAIN => $builder->get();
82 }
83
87 protected function createModalAndButton(
88 PathInterface $base_path,
90 ElementInterface ...$elements
91 ): \Generator {
92 foreach ($elements as $element) {
93 if (!$element->isScaffold()) {
94 continue;
95 }
96 $modal = $this->services->actions()->getModal()->create(
97 $base_path,
98 $element,
99 $request
100 );
101 $button = $this->services->actions()->getButton()->create(
102 $modal->getFlexibleSignal(),
103 $element
104 );
105 yield ContentType::MODAL => $modal;
106 yield ContentType::TOOLBAR => $button;
107 }
108 }
109}
createModalAndButton(PathInterface $base_path, ?RequestForFormInterface $request, ElementInterface ... $elements)
content(PathInterface $base_path, ?RequestForFormInterface $request, ElementInterface ... $elements)
__construct(FullEditorServices $services)
This describes commonalities between standard and primary buttons.
Definition: Button.php:34