API Standardise extension hooks (#202)

This commit is contained in:
Guy Sartorelli 2024-08-27 15:39:21 +12:00 committed by GitHub
parent 791d49354d
commit 31464347a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 7 additions and 7 deletions

View File

@ -24,7 +24,7 @@ class FrameworkTestRole extends DataExtension
); );
} }
public function requireDefaultRecords() protected function onRequireDefaultRecords()
{ {
$hasTestMembers = Member::get()->find('Email', 'hayley@test.com'); $hasTestMembers = Member::get()->find('Email', 'hayley@test.com');
if (!$hasTestMembers) { if (!$hasTestMembers) {

View File

@ -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); 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); 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); 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); return Permission::check('TEST_DATAOBJECT_EDIT', 'any', $member);
} }

View File

@ -28,7 +28,7 @@ class ElementContentExtension extends Extension
'MyFile' => File::class, 'MyFile' => File::class,
]; ];
public function validate(ValidationResult $result) protected function updatevalidate(ValidationResult $result)
{ {
if ($this->owner->Title == 'x') { if ($this->owner->Title == 'x') {
$result->addFieldError('Title', 'Title cannot be x'); $result->addFieldError('Title', 'Title cannot be x');

View File

@ -8,7 +8,7 @@ use Symbiote\GridFieldExtensions\GridFieldNestedForm;
class SecurityAdminExtension extends Extension class SecurityAdminExtension extends Extension
{ {
public function updateGridFieldConfig($config) protected function updateGridFieldConfig($config)
{ {
if ($this->owner->getModelClass() === Group::class) { if ($this->owner->getModelClass() === Group::class) {
$config->addComponent(GridFieldNestedForm::create()->setRelationName('Members')); $config->addComponent(GridFieldNestedForm::create()->setRelationName('Members'));