mirror of
https://github.com/silverstripe/silverstripe-frameworktest
synced 2024-10-22 11:06:02 +02:00
API Standardise extension hooks (#202)
This commit is contained in:
parent
791d49354d
commit
31464347a0
@ -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) {
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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');
|
||||||
|
@ -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'));
|
||||||
|
Loading…
Reference in New Issue
Block a user