-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API Use dynamic config for ModalController forms #3029
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
|
||
use Page; | ||
use SilverStripe\Admin\LeftAndMain; | ||
use SilverStripe\Admin\ModalController; | ||
use SilverStripe\CampaignAdmin\AddToCampaignHandler; | ||
use SilverStripe\CMS\Model\SiteTree; | ||
use SilverStripe\Control\Controller; | ||
|
@@ -37,18 +36,11 @@ 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' => $modalController->Link('schema/editorInternalLink'), | ||
], | ||
'editorAnchorLink' => [ | ||
'schemaUrl' => $modalController->Link('schema/editorAnchorLink/:pageid'), | ||
], | ||
Comment on lines
-46
to
-51
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These get included in |
||
], | ||
]); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ protected function getFormFields($controller, $name, $context) | |
|
||
// Ensure current page is selected | ||
$pageIDField = $fields->dataFieldByName('PageID'); | ||
$pageIDField->setValue((int)$context['PageID']); | ||
$pageIDField->setValue((int)$context['ItemID']); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was changed to be more generic so we can reuse it in other link forms if needed. |
||
|
||
// Get anchor selector field | ||
$fields->insertAfter( | ||
|
@@ -22,6 +22,6 @@ protected function getFormFields($controller, $name, $context) | |
|
||
public function getRequiredContext() | ||
{ | ||
return array_merge(parent::getRequiredContext(), [ 'PageID' ]); | ||
return array_merge(parent::getRequiredContext(), [ 'ItemID' ]); | ||
} | ||
} |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LeftAndMain
now dynamically lists all link forms registered withModalController.link_modal_form_factories
These do get inherited, so
CMSPageEditController
would still work, but it seems sensible to use the more generic controller here (especially sinceCMSPageEditController
is not long for this world)