From 11602cecc1e61db9e6cb7a9b83d3c83d7b21f350 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Thu, 17 Oct 2024 13:14:53 +1300 Subject: [PATCH] API Update code to reflect changes in silverstripe/cms --- code/Model/EditableCustomRule.php | 2 +- code/Model/EditableFormField.php | 4 ++-- code/Model/Recipient/EmailRecipient.php | 4 ++-- code/Model/Recipient/EmailRecipientCondition.php | 2 +- code/Model/UserDefinedForm.php | 4 ++-- lang/en.yml | 1 + 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/code/Model/EditableCustomRule.php b/code/Model/EditableCustomRule.php index 08fa1b40..f4880232 100644 --- a/code/Model/EditableCustomRule.php +++ b/code/Model/EditableCustomRule.php @@ -119,7 +119,7 @@ protected function getCanCreateContext($args) } // Hack in currently edited page if context is missing if (Controller::has_curr() && Controller::curr() instanceof CMSMain) { - return Controller::curr()->currentPage(); + return Controller::curr()->currentRecord(); } // No page being edited diff --git a/code/Model/EditableFormField.php b/code/Model/EditableFormField.php index 231cd0fe..986787e6 100755 --- a/code/Model/EditableFormField.php +++ b/code/Model/EditableFormField.php @@ -509,7 +509,7 @@ public function canEdit($member = null) // This is to restore User Forms 2.x backwards compatibility. $controller = Controller::curr(); if ($controller && $controller instanceof CMSPageEditController) { - $parent = $controller->getRecord($controller->currentPageID()); + $parent = $controller->getRecord($controller->currentRecordID()); // Only allow this behaviour on pages using UserFormFieldEditorExtension, such // as UserDefinedForm page type. if ($parent && $parent->hasExtension(UserFormFieldEditorExtension::class)) { @@ -572,7 +572,7 @@ protected function getCanCreateContext($args) } // Hack in currently edited page if context is missing if (Controller::has_curr() && Controller::curr() instanceof CMSMain) { - return Controller::curr()->currentPage(); + return Controller::curr()->currentRecord(); } // No page being edited diff --git a/code/Model/Recipient/EmailRecipient.php b/code/Model/Recipient/EmailRecipient.php index c3daf7cd..fad9c0d7 100644 --- a/code/Model/Recipient/EmailRecipient.php +++ b/code/Model/Recipient/EmailRecipient.php @@ -234,7 +234,7 @@ protected function getFormParent() // LeftAndMain::sessionNamespace is protected. $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) { return UserDefinedForm::get()->byID($formID); } @@ -466,7 +466,7 @@ protected function getCanCreateContext($args) } // Hack in currently edited page if context is missing if (Controller::has_curr() && Controller::curr() instanceof CMSMain) { - return Controller::curr()->currentPage(); + return Controller::curr()->currentRecord(); } // No page being edited diff --git a/code/Model/Recipient/EmailRecipientCondition.php b/code/Model/Recipient/EmailRecipientCondition.php index 760baf45..48b882cb 100644 --- a/code/Model/Recipient/EmailRecipientCondition.php +++ b/code/Model/Recipient/EmailRecipientCondition.php @@ -143,7 +143,7 @@ protected function getCanCreateContext($args) } // Hack in currently edited page if context is missing if (Controller::has_curr() && Controller::curr() instanceof CMSMain) { - return Controller::curr()->currentPage(); + return Controller::curr()->currentRecord(); } // No page being edited diff --git a/code/Model/UserDefinedForm.php b/code/Model/UserDefinedForm.php index eaa2c203..8f146c5f 100755 --- a/code/Model/UserDefinedForm.php +++ b/code/Model/UserDefinedForm.php @@ -19,12 +19,12 @@ class UserDefinedForm extends Page /** * @var string */ - private static $icon_class = 'font-icon-p-list'; + private static $cms_icon_class = 'font-icon-p-list'; /** * @var string */ - private static $description = 'Adds a customizable form.'; + private static $class_description = 'Adds a customizable form.'; /** * @var string diff --git a/lang/en.yml b/lang/en.yml index aa9f2dd0..2f6a7d48 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -353,6 +353,7 @@ en: has_one_Parent: Parent SilverStripe\UserForms\Model\UserDefinedForm: ADDEMAILRECIPIENT: 'Add Email Recipient' + CLASS_DESCRIPTION: 'Adds a customizable form.' CLEARBUTTON: Clear CONFIGURATION: Configuration DESCRIPTION: 'Adds a customizable form.'