Skip to content

Commit

Permalink
API Update code to reflect changes in silverstripe/cms
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Oct 22, 2024
1 parent 4f821d1 commit debd1d4
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion code/Model/EditableCustomRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions code/Model/EditableFormField.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions code/Model/Recipient/EmailRecipient.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,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);
}
Expand Down Expand Up @@ -460,7 +460,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
Expand Down
2 changes: 1 addition & 1 deletion code/Model/Recipient/EmailRecipientCondition.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/Model/UserDefinedForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ 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
Expand Down

0 comments on commit debd1d4

Please sign in to comment.