Skip to content

Commit

Permalink
Update notes on move pop up
Browse files Browse the repository at this point in the history
  • Loading branch information
Jianbinzhu committed Aug 16, 2023
1 parent e3e67d8 commit c0aa5d8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion client/src/components/ElementActions/MoveAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
Expand Down
17 changes: 12 additions & 5 deletions src/Forms/MoveElementHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -23,7 +24,7 @@ class MoveElementHandler
*
* @var Controller
*/
protected $controller;
protected ?Controller $controller;

public function __construct($controller = null)
{
Expand All @@ -35,7 +36,11 @@ public function Form($elementID)
$fields = FieldList::create([
LiteralField::create(
'MoveWarning',
'<p class="alert alert-info"><strong>Note</strong>: All published blocks will changed draft state once moved.</p>'
'<p class="alert alert-info">' .
'<strong>Note</strong>: 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.' .
'</p>'
),
HiddenField::create(
'ElementID',
Expand Down Expand Up @@ -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 <strong>{PageName}</strong> to move <strong>{BlockName}</strong> to',
'Could not find an elemental area on <strong>{PageName}</strong> to move ' .
'<strong>{BlockName}</strong> to',
[
'PageName' => $page->Title,
'BlockName' => $element->Title
Expand All @@ -91,7 +97,8 @@ public function moveElement($element, $formData)
if (!$page->canEdit() || !$element->canEdit()) {
throw $this->validationResult(_t(
__CLASS__ . '.InsufficientPermissions',
'Can not move <strong>{PageName}</strong> to <strong>{BlockName}</strong> due to insufficient permissions',
'Can not move <strong>{PageName}</strong> to <strong>{BlockName}</strong> due to ' .
'insufficient permissions',
[
'PageName' => $page->Title,
'BlockName' => $element->Title
Expand Down Expand Up @@ -140,4 +147,4 @@ protected function validationResult($message, $field = null)
->addFieldError($field, $message);
return new ValidationException($error);
}
}
}

0 comments on commit c0aa5d8

Please sign in to comment.