19declare(strict_types=1);
68 public function delete(
71 bool $props_from_data = false
77 $action = $this->link_provider->delete(
84 if ($props_from_data) {
85 $content = $this->properties_fetcher->getPropertiesByData($to_be_deleted);
87 $content = $this->properties_fetcher->getPropertiesByPreview($to_be_deleted);
89 foreach ($content as $key => $value) {
90 $items[] = $this->
factory->modal()->interruptiveItem()->keyValue(
91 'md_delete_' . $index,
92 $this->presenter->utilities()->shortenString($key, self::MAX_LENGTH),
93 $this->presenter->utilities()->shortenString($value, self::MAX_LENGTH),
98 $modal = $this->
factory->modal()->interruptive(
100 Command::DELETE_FULL,
103 $this->presenter->utilities()->txt(
'meta_delete_confirm'),
105 )->withAffectedItems($items);
115 $form = $this->form_factory->getUpdateForm(
123 Command::UPDATE_FULL,
135 $form = $this->form_factory->getCreateForm(
141 if (empty($form->getInputs())) {
145 $modal = $this->getRoundtripModal(
148 Command::CREATE_FULL,
162 $this->getModalTitle($action_cmd, $element),
167 return $this->handleError($modal, $element, $request);
171 RoundtripModal $modal,
175 if (is_null($request)) {
178 $action_path = $this->path_factory->toElement($element,
true);
179 if (strtolower($action_path->toString()) !== strtolower($request->path()?->toString() ??
'')) {
184 $modal = $request->applyRequestToModal($modal);
191 ($group = $modal->getInputs()[0]) instanceof
Group &&
192 $error = $group->getError()
194 $modal = $this->
factory->modal()->roundtrip(
196 [$this->factory->messageBox()->failure($error)],
200 $modal = $request->applyRequestToModal($modal);
203 $modal = $modal->withOnLoad($modal->getShowSignal());
212 switch ($action_cmd) {
213 case Command::UPDATE_FULL:
214 $title_key =
'meta_edit_element';
217 case Command::CREATE_FULL:
218 $title_key =
'meta_add_element';
221 case Command::DELETE_FULL:
222 $title_key =
'meta_delete_element';
226 throw new \ilMDEditorException(
227 'Invalid action: ' . $action_cmd->name
230 return $this->presenter->utilities()->txtFill(
232 $this->presenter->elements()->nameWithParents(
243 foreach ($this->constraint_dictionary->tagsForElement($element) as $tag) {
244 if ($tag->restriction() === Restriction::NOT_DELETABLE) {
Builds a Color from either hex- or rgb values.
modal(string $title="", string $cancel_label="")
if(!file_exists('../ilias.ini.php'))