diff --git a/code/Controllers/CMSPageEditController.php b/code/Controllers/CMSPageEditController.php index 67dcfb3827..fb9e95b96b 100644 --- a/code/Controllers/CMSPageEditController.php +++ b/code/Controllers/CMSPageEditController.php @@ -4,6 +4,7 @@ use Page; use SilverStripe\Admin\LeftAndMain; +use SilverStripe\Admin\ModalController; use SilverStripe\CampaignAdmin\AddToCampaignHandler; use SilverStripe\CMS\Model\SiteTree; use SilverStripe\Control\Controller; @@ -36,18 +37,17 @@ class CMSPageEditController extends CMSMain public function getClientConfig(): array { + $modalController = ModalController::singleton(); return ArrayLib::array_merge_recursive(parent::getClientConfig(), [ 'form' => [ 'AddToCampaignForm' => [ 'schemaUrl' => $this->Link('schema/AddToCampaignForm'), ], 'editorInternalLink' => [ - 'schemaUrl' => LeftAndMain::singleton() - ->Link('methodSchema/Modals/editorInternalLink'), + 'schemaUrl' => $modalController->Link('schema/editorInternalLink'), ], 'editorAnchorLink' => [ - 'schemaUrl' => LeftAndMain::singleton() - ->Link('methodSchema/Modals/editorAnchorLink/:pageid'), + 'schemaUrl' => $modalController->Link('schema/editorAnchorLink/:pageid'), ], ], ]); diff --git a/code/Forms/InternalLinkModalExtension.php b/code/Forms/InternalLinkModalExtension.php index 071c2efb27..cf3edd41da 100644 --- a/code/Forms/InternalLinkModalExtension.php +++ b/code/Forms/InternalLinkModalExtension.php @@ -15,7 +15,7 @@ class InternalLinkModalExtension extends Extension { private static $url_handlers = [ - 'editorAnchorLink/$ItemID' => 'editorAnchorLink', // Matches LeftAndMain::methodSchema args + 'editorAnchorLink/$ItemID' => 'editorAnchorLink', // Matches FormSchemaController::schema args ]; private static $allowed_actions = [ @@ -41,7 +41,7 @@ public function editorInternalLink() public function editorAnchorLink() { - // Note: Should work both via MethodSchema and as direct request + // Note: Should work both via schema() and as direct request $request = $this->getOwner()->getRequest(); $showLinkText = $request->getVar('requireLinkText'); $pageID = $request->param('ItemID'); diff --git a/tests/behat/features/insert-a-link.feature b/tests/behat/features/insert-a-link.feature index 5305ee007c..d0eb707943 100644 --- a/tests/behat/features/insert-a-link.feature +++ b/tests/behat/features/insert-a-link.feature @@ -66,7 +66,7 @@ So that I can link to a external website or a page on my site Given I select "awesome" in the "Content" HTML field And I press the "Insert link" HTML field button When I click "Link to external URL" in the ".tox-collection__group" element - And I should see an "form#Form_ModalsEditorExternalLink" element + And I should see an "form#Form_EditorExternalLink" element When I fill in "http://silverstripe.org" for "URL" And I check "Open in new window/tab" And I press the "Insert link" button @@ -80,7 +80,7 @@ So that I can link to a external website or a page on my site When I select the image "file1.jpg" in the "Content" HTML field And I press the "Insert link" HTML field button When I click "Link to external URL" in the ".tox-collection__group" element - And I should see an "form#Form_ModalsEditorExternalLink" element + And I should see an "form#Form_EditorExternalLink" element And I should not see "Link text" When I fill in "http://silverstripe.org" for "URL" And I press the "Insert link" button @@ -94,7 +94,7 @@ So that I can link to a external website or a page on my site And I select "awesome" in the "Content" HTML field When I press the "Insert link" HTML field button And I click "Link to external URL" in the ".tox-collection__group" element - And I should see an "form#Form_ModalsEditorExternalLink" element + And I should see an "form#Form_EditorExternalLink" element Then the "URL" field should contain "http://silverstripe.org" # This doesn't seem to suffer from that issue When I fill in "http://google.com" for "URL"