-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/lib/Form/TrashLocationOptionProvider/CanHaveDrafts.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Ibexa\AdminUi\Form\TrashLocationOptionProvider; | ||
|
||
use Ibexa\Contracts\Core\Repository\Values\Content\Location; | ||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | ||
use Symfony\Component\Form\FormInterface; | ||
use Symfony\Contracts\Translation\TranslatorInterface; | ||
|
||
final class CanHaveDrafts implements TrashLocationOptionProvider | ||
{ | ||
private TranslatorInterface $translator; | ||
|
||
public function __construct(TranslatorInterface $translator) | ||
{ | ||
$this->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', [], 'messages'), | ||
], | ||
]); | ||
} | ||
} |