From c0aa5d8307958f3c43e642e7dc38110a3d4d5fbd Mon Sep 17 00:00:00 2001 From: James Zhu Date: Thu, 17 Aug 2023 10:34:45 +1200 Subject: [PATCH] Update notes on move pop up --- .../src/components/ElementActions/MoveAction.js | 2 +- src/Forms/MoveElementHandler.php | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/client/src/components/ElementActions/MoveAction.js b/client/src/components/ElementActions/MoveAction.js index b4ac2e14..fb0bfda7 100644 --- a/client/src/components/ElementActions/MoveAction.js +++ b/client/src/components/ElementActions/MoveAction.js @@ -44,7 +44,7 @@ const MoveAction = (MenuComponent) => (props) => { disabled, className: 'element-editor__actions-move', onClick: handleClick, - toggle: props.toggle, // todo: what is this? + toggle: props.toggle, }; const modalSchemaUrl = `${getConfig().form.elementForm.moveModalSchemaUrl}/${id}`; diff --git a/src/Forms/MoveElementHandler.php b/src/Forms/MoveElementHandler.php index c21cb395..95184ec9 100644 --- a/src/Forms/MoveElementHandler.php +++ b/src/Forms/MoveElementHandler.php @@ -4,6 +4,7 @@ use DNADesign\Elemental\Extensions\ElementalPageExtension; use SilverStripe\CMS\Model\SiteTree; +use SilverStripe\Control\Controller; use SilverStripe\Core\Injector\Injectable; use SilverStripe\Forms\FieldList; use SilverStripe\Forms\Form; @@ -23,7 +24,7 @@ class MoveElementHandler * * @var Controller */ - protected $controller; + protected ?Controller $controller; public function __construct($controller = null) { @@ -35,7 +36,11 @@ public function Form($elementID) $fields = FieldList::create([ LiteralField::create( 'MoveWarning', - '

Note: All published blocks will changed draft state once moved.

' + '

' . + 'Note: All published blocks will changed draft state once moved. ' . + 'If you would like to copy this block to another page, duplicate this block and then ' . + 'move the duplicate.' . + '

' ), HiddenField::create( 'ElementID', @@ -80,7 +85,8 @@ public function moveElement($element, $formData) if (!$page->ElementalArea()->exists()) { throw $this->validationResult(_t( __CLASS__ . '.ElementalAreaNotFound', - 'Could not find an elemental area on {PageName} to move {BlockName} to', + 'Could not find an elemental area on {PageName} to move ' . + '{BlockName} to', [ 'PageName' => $page->Title, 'BlockName' => $element->Title @@ -91,7 +97,8 @@ public function moveElement($element, $formData) if (!$page->canEdit() || !$element->canEdit()) { throw $this->validationResult(_t( __CLASS__ . '.InsufficientPermissions', - 'Can not move {PageName} to {BlockName} due to insufficient permissions', + 'Can not move {PageName} to {BlockName} due to ' . + 'insufficient permissions', [ 'PageName' => $page->Title, 'BlockName' => $element->Title @@ -140,4 +147,4 @@ protected function validationResult($message, $field = null) ->addFieldError($field, $message); return new ValidationException($error); } -} \ No newline at end of file +}