Skip to content

Commit

Permalink
API Deprecate API that's changing in CMS 6 (#1357)
Browse files Browse the repository at this point in the history
* ENH Avoid using deprecated API

* API Deprecate API that's changing in CMS 6
  • Loading branch information
GuySartorelli authored Dec 10, 2024
1 parent 76be354 commit 184dad7
Show file tree
Hide file tree
Showing 6 changed files with 8 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
2 changes: 1 addition & 1 deletion code/Model/Recipient/EmailRecipient.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,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
3 changes: 2 additions & 1 deletion code/Model/UserDefinedForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ class UserDefinedForm extends Page

/**
* @var string
* @deprecated 6.4.0 Will be renamed to cms_icon_class
*/
private static $icon_class = 'font-icon-p-list';

/**
* @var string
* @deprecated 5.4.0 use class_description instead.
* @deprecated 6.4.0 use class_description instead.
*/
private static $description = 'Adds a customizable form.';

Expand Down
2 changes: 1 addition & 1 deletion tests/php/Form/GridFieldAddClassesButtonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testHandleAddUpdatesModifiedFormData()
$request = new HTTPRequest('GET', '/');
$request->setSession(new Session([]));
$controller->setRequest($request);
$controller->setCurrentPageID($udf->ID);
$controller->setCurrentRecordID($udf->ID);
$controller->pushCurrent();
$list = new DataList(EditableFormField::class);
$field = EditableTextField::create([
Expand Down

0 comments on commit 184dad7

Please sign in to comment.