diff --git a/src/bundle/Resources/config/services/forms.yaml b/src/bundle/Resources/config/services/forms.yaml index bdd11af7d7..f5ad33e4ce 100644 --- a/src/bundle/Resources/config/services/forms.yaml +++ b/src/bundle/Resources/config/services/forms.yaml @@ -379,6 +379,10 @@ services: tags: - { name: ibexa.admin_ui.form.trash_location_option, priority: 60 } + Ibexa\AdminUi\Form\TrashLocationOptionProvider\CanHaveDrafts: + tags: + - { name: ibexa.admin_ui.form.trash_location_option, priority: 20 } + Ibexa\AdminUi\Form\TrashLocationOptionProvider\OptionsFactory: arguments: [!tagged ibexa.admin_ui.form.trash_location_option] diff --git a/src/bundle/Resources/public/scss/_modals.scss b/src/bundle/Resources/public/scss/_modals.scss index ff45e56ff6..b720929f1e 100644 --- a/src/bundle/Resources/public/scss/_modals.scss +++ b/src/bundle/Resources/public/scss/_modals.scss @@ -21,6 +21,21 @@ .modal-body { @include modal-body(); + + .ibexa-modal__trash-option { + .ibexa-modal__option-label { + margin-bottom: 0; + margin-top: calculateRem(18px); + } + + .ibexa-label { + font-size: calculateRem(16px); + } + + .ibexa-modal__option-description { + font-size: calculateRem(14px); + } + } } .modal-footer { diff --git a/src/bundle/Resources/translations/ibexa_drafts.en.xliff b/src/bundle/Resources/translations/ibexa_drafts.en.xliff index b71e873df7..1a0596f0a8 100644 --- a/src/bundle/Resources/translations/ibexa_drafts.en.xliff +++ b/src/bundle/Resources/translations/ibexa_drafts.en.xliff @@ -66,6 +66,11 @@ Version key: drafts.list.version + + Sending this content item to Trash will also delete all drafts of content items that haven’t been published yet, and belong to the trashed subtree. + Sending this content item to Trash will also delete all drafts of content items that haven’t been published yet, and belong to the trashed subtree. + key: trash.modal.send_to_trash_draft_warning.message + diff --git a/src/lib/Form/TrashLocationOptionProvider/CanHaveDrafts.php b/src/lib/Form/TrashLocationOptionProvider/CanHaveDrafts.php new file mode 100644 index 0000000000..c070fd69ec --- /dev/null +++ b/src/lib/Form/TrashLocationOptionProvider/CanHaveDrafts.php @@ -0,0 +1,43 @@ +translator = $translator; + } + + public function supports(Location $location): bool + { + return true; + } + + public function addOptions(FormInterface $form, Location $location): void + { + $form + ->add('can_have_drafts', ChoiceType::class, [ + 'label' => + /** @Desc("Drafts") */ + $this->translator->trans('drafts.list', [], 'ibexa_drafts'), + 'help_multiline' => [ + /** @Desc("Sending this content item to Trash will also delete all drafts of content items that haven’t been published yet, and belong to the trashed subtree.") */ + $this->translator->trans('trash.modal.send_to_trash_draft_warning.message', [], 'ibexa_drafts'), + ], + ]); + } +}