Skip to content

Commit 33e1556

Browse files
ENH Update code to reflect changes in silverstripe/admin (#3024)
1 parent 72a5cc8 commit 33e1556

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

code/Controllers/CMSPageEditController.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Page;
66
use SilverStripe\Admin\LeftAndMain;
7+
use SilverStripe\Admin\ModalController;
78
use SilverStripe\CampaignAdmin\AddToCampaignHandler;
89
use SilverStripe\CMS\Model\SiteTree;
910
use SilverStripe\Control\Controller;
@@ -36,18 +37,17 @@ class CMSPageEditController extends CMSMain
3637

3738
public function getClientConfig(): array
3839
{
40+
$modalController = ModalController::singleton();
3941
return ArrayLib::array_merge_recursive(parent::getClientConfig(), [
4042
'form' => [
4143
'AddToCampaignForm' => [
4244
'schemaUrl' => $this->Link('schema/AddToCampaignForm'),
4345
],
4446
'editorInternalLink' => [
45-
'schemaUrl' => LeftAndMain::singleton()
46-
->Link('methodSchema/Modals/editorInternalLink'),
47+
'schemaUrl' => $modalController->Link('schema/editorInternalLink'),
4748
],
4849
'editorAnchorLink' => [
49-
'schemaUrl' => LeftAndMain::singleton()
50-
->Link('methodSchema/Modals/editorAnchorLink/:pageid'),
50+
'schemaUrl' => $modalController->Link('schema/editorAnchorLink/:pageid'),
5151
],
5252
],
5353
]);

code/Forms/InternalLinkModalExtension.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
class InternalLinkModalExtension extends Extension
1616
{
1717
private static $url_handlers = [
18-
'editorAnchorLink/$ItemID' => 'editorAnchorLink', // Matches LeftAndMain::methodSchema args
18+
'editorAnchorLink/$ItemID' => 'editorAnchorLink', // Matches FormSchemaController::schema args
1919
];
2020

2121
private static $allowed_actions = [
@@ -41,7 +41,7 @@ public function editorInternalLink()
4141

4242
public function editorAnchorLink()
4343
{
44-
// Note: Should work both via MethodSchema and as direct request
44+
// Note: Should work both via schema() and as direct request
4545
$request = $this->getOwner()->getRequest();
4646
$showLinkText = $request->getVar('requireLinkText');
4747
$pageID = $request->param('ItemID');

tests/behat/features/insert-a-link.feature

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ So that I can link to a external website or a page on my site
6666
Given I select "awesome" in the "Content" HTML field
6767
And I press the "Insert link" HTML field button
6868
When I click "Link to external URL" in the ".tox-collection__group" element
69-
And I should see an "form#Form_ModalsEditorExternalLink" element
69+
And I should see an "form#Form_EditorExternalLink" element
7070
When I fill in "http://silverstripe.org" for "URL"
7171
And I check "Open in new window/tab"
7272
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
8080
When I select the image "file1.jpg" in the "Content" HTML field
8181
And I press the "Insert link" HTML field button
8282
When I click "Link to external URL" in the ".tox-collection__group" element
83-
And I should see an "form#Form_ModalsEditorExternalLink" element
83+
And I should see an "form#Form_EditorExternalLink" element
8484
And I should not see "Link text"
8585
When I fill in "http://silverstripe.org" for "URL"
8686
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
9494
And I select "awesome" in the "Content" HTML field
9595
When I press the "Insert link" HTML field button
9696
And I click "Link to external URL" in the ".tox-collection__group" element
97-
And I should see an "form#Form_ModalsEditorExternalLink" element
97+
And I should see an "form#Form_EditorExternalLink" element
9898
Then the "URL" field should contain "http://silverstripe.org"
9999
# This doesn't seem to suffer from that issue
100100
When I fill in "http://google.com" for "URL"

0 commit comments

Comments
 (0)