Compare commits

...

2 Commits

Author SHA1 Message Date
Guy Sartorelli
3c9f60f0a8
Merge 317b6548d7 into 574ca14ee7 2024-10-22 05:31:24 +13:00
Guy Sartorelli
317b6548d7
ENH Update code to reflect changes in CMSMain 2024-10-17 13:14:53 +13:00
4 changed files with 6 additions and 6 deletions

View File

@ -119,7 +119,7 @@ class EditableCustomRule extends DataObject
} }
// Hack in currently edited page if context is missing // Hack in currently edited page if context is missing
if (Controller::has_curr() && Controller::curr() instanceof CMSMain) { if (Controller::has_curr() && Controller::curr() instanceof CMSMain) {
return Controller::curr()->currentPage(); return Controller::curr()->currentRecord();
} }
// No page being edited // No page being edited

View File

@ -509,7 +509,7 @@ class EditableFormField extends DataObject
// This is to restore User Forms 2.x backwards compatibility. // This is to restore User Forms 2.x backwards compatibility.
$controller = Controller::curr(); $controller = Controller::curr();
if ($controller && $controller instanceof CMSPageEditController) { if ($controller && $controller instanceof CMSPageEditController) {
$parent = $controller->getRecord($controller->currentPageID()); $parent = $controller->getRecord($controller->currentRecordID());
// Only allow this behaviour on pages using UserFormFieldEditorExtension, such // Only allow this behaviour on pages using UserFormFieldEditorExtension, such
// as UserDefinedForm page type. // as UserDefinedForm page type.
if ($parent && $parent->hasExtension(UserFormFieldEditorExtension::class)) { if ($parent && $parent->hasExtension(UserFormFieldEditorExtension::class)) {
@ -572,7 +572,7 @@ class EditableFormField extends DataObject
} }
// Hack in currently edited page if context is missing // Hack in currently edited page if context is missing
if (Controller::has_curr() && Controller::curr() instanceof CMSMain) { if (Controller::has_curr() && Controller::curr() instanceof CMSMain) {
return Controller::curr()->currentPage(); return Controller::curr()->currentRecord();
} }
// No page being edited // No page being edited

View File

@ -228,7 +228,7 @@ class EmailRecipient extends DataObject
// LeftAndMain::sessionNamespace is protected. // LeftAndMain::sessionNamespace is protected.
$sessionNamespace = $this->config()->get('session_namespace') ?: CMSMain::class; $sessionNamespace = $this->config()->get('session_namespace') ?: CMSMain::class;
$formID = Controller::curr()->getRequest()->getSession()->get($sessionNamespace . '.currentPage'); $formID = Controller::curr()->getRequest()->getSession()->get($sessionNamespace . '.currentRecord');
if ($formID) { if ($formID) {
return UserDefinedForm::get()->byID($formID); return UserDefinedForm::get()->byID($formID);
} }
@ -460,7 +460,7 @@ class EmailRecipient extends DataObject
} }
// Hack in currently edited page if context is missing // Hack in currently edited page if context is missing
if (Controller::has_curr() && Controller::curr() instanceof CMSMain) { if (Controller::has_curr() && Controller::curr() instanceof CMSMain) {
return Controller::curr()->currentPage(); return Controller::curr()->currentRecord();
} }
// No page being edited // No page being edited

View File

@ -143,7 +143,7 @@ class EmailRecipientCondition extends DataObject
} }
// Hack in currently edited page if context is missing // Hack in currently edited page if context is missing
if (Controller::has_curr() && Controller::curr() instanceof CMSMain) { if (Controller::has_curr() && Controller::curr() instanceof CMSMain) {
return Controller::curr()->currentPage(); return Controller::curr()->currentRecord();
} }
// No page being edited // No page being edited