19 declare(strict_types=1);
69 public function delete(
72 bool $props_from_data = false
78 $action = $this->link_provider->delete(
85 if ($props_from_data) {
86 $content = $this->properties_fetcher->getPropertiesByData($to_be_deleted);
88 $content = $this->properties_fetcher->getPropertiesByPreview($to_be_deleted);
90 foreach ($content as $key => $value) {
91 $items[] = $this->
factory->modal()->interruptiveItem()->keyValue(
92 'md_delete_' . $index,
93 $this->presenter->utilities()->shortenString($key, self::MAX_LENGTH),
94 $this->presenter->utilities()->shortenString($value, self::MAX_LENGTH),
99 $modal = $this->
factory->modal()->interruptive(
101 Command::DELETE_FULL,
104 $this->presenter->utilities()->txt(
'meta_delete_confirm'),
106 )->withAffectedItems($items);
116 $form = $this->form_factory->getUpdateForm(
124 Command::UPDATE_FULL,
136 $form = $this->form_factory->getCreateForm(
142 if (empty($form->getInputs())) {
149 Command::CREATE_FULL,
162 $modal = $this->
factory->modal()->roundtrip(
168 return $this->
handleError($modal, $element, $request);
176 if (is_null($request)) {
179 $action_path = $this->path_factory->toElement($element,
true);
180 if (strtolower($action_path->toString()) !== strtolower($request->
path()?->toString() ??
'')) {
192 ($group = $modal->getInputs()[0]) instanceof
Group &&
193 $error = $group->getError()
195 $modal = $this->
factory->modal()->roundtrip(
204 $modal = $modal->withOnLoad($modal->getShowSignal());
213 switch ($action_cmd) {
214 case Command::UPDATE_FULL:
215 $title_key =
'meta_edit_element';
218 case Command::CREATE_FULL:
219 $title_key =
'meta_add_element';
222 case Command::DELETE_FULL:
223 $title_key =
'meta_delete_element';
227 throw new \ilMDEditorException(
228 'Invalid action: ' . $action_cmd->name
231 return $this->presenter->utilities()->txtFill(
233 $this->presenter->elements()->nameWithParents(
244 foreach ($this->constraint_dictionary->tagsForElement($element) as $tag) {
245 if ($tag->restriction() === Restriction::NOT_DELETABLE) {
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null