From 31464347a02ef5d6f2d19163396411e22d1a92dc Mon Sep 17 00:00:00 2001 From: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com> Date: Tue, 27 Aug 2024 15:39:21 +1200 Subject: [PATCH] API Standardise extension hooks (#202) --- code/FrameworkTestRole.php | 2 +- code/TestDataObjectExtension.php | 8 ++++---- code/elemental/ElementContentExtension.php | 2 +- code/fields/NestedGridField/SecurityAdminExtension.php | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/code/FrameworkTestRole.php b/code/FrameworkTestRole.php index dbf270f..b838d43 100644 --- a/code/FrameworkTestRole.php +++ b/code/FrameworkTestRole.php @@ -24,7 +24,7 @@ class FrameworkTestRole extends DataExtension ); } - public function requireDefaultRecords() + protected function onRequireDefaultRecords() { $hasTestMembers = Member::get()->find('Email', 'hayley@test.com'); if (!$hasTestMembers) { diff --git a/code/TestDataObjectExtension.php b/code/TestDataObjectExtension.php index a59aeb4..c1346c8 100644 --- a/code/TestDataObjectExtension.php +++ b/code/TestDataObjectExtension.php @@ -24,22 +24,22 @@ class TestDataObjectExtension extends DataExtension implements PermissionProvide ]; } - public function canView($member = null) + protected function canView($member = null) { return Permission::check('TEST_DATAOBJECT_EDIT', 'any', $member); } - public function canEdit($member = null) + protected function canEdit($member = null) { return Permission::check('TEST_DATAOBJECT_EDIT', 'any', $member); } - public function canDelete($member = null) + protected function canDelete($member = null) { return Permission::check('TEST_DATAOBJECT_EDIT', 'any', $member); } - public function canCreate($member = null, $context = []) + protected function canCreate($member = null, $context = []) { return Permission::check('TEST_DATAOBJECT_EDIT', 'any', $member); } diff --git a/code/elemental/ElementContentExtension.php b/code/elemental/ElementContentExtension.php index 6325ef6..fda1075 100644 --- a/code/elemental/ElementContentExtension.php +++ b/code/elemental/ElementContentExtension.php @@ -28,7 +28,7 @@ class ElementContentExtension extends Extension 'MyFile' => File::class, ]; - public function validate(ValidationResult $result) + protected function updatevalidate(ValidationResult $result) { if ($this->owner->Title == 'x') { $result->addFieldError('Title', 'Title cannot be x'); diff --git a/code/fields/NestedGridField/SecurityAdminExtension.php b/code/fields/NestedGridField/SecurityAdminExtension.php index 5cd0cd8..f5dc085 100644 --- a/code/fields/NestedGridField/SecurityAdminExtension.php +++ b/code/fields/NestedGridField/SecurityAdminExtension.php @@ -8,7 +8,7 @@ use Symbiote\GridFieldExtensions\GridFieldNestedForm; class SecurityAdminExtension extends Extension { - public function updateGridFieldConfig($config) + protected function updateGridFieldConfig($config) { if ($this->owner->getModelClass() === Group::class) { $config->addComponent(GridFieldNestedForm::create()->setRelationName('Members'));