mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merge pull request #11252 from creative-commoners/pulls/6/protect-hooks2
API Set extension hook implementation visibility to protected
This commit is contained in:
commit
1217806f9d
@ -63,7 +63,7 @@ abstract class DataExtension extends Extension
|
||||
*
|
||||
* See {@link DataObject::onBeforeWrite()} for context.
|
||||
*/
|
||||
public function onBeforeWrite()
|
||||
protected function onBeforeWrite()
|
||||
{
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ abstract class DataExtension extends Extension
|
||||
*
|
||||
* See {@link DataObject::onAfterWrite()} for context.
|
||||
*/
|
||||
public function onAfterWrite()
|
||||
protected function onAfterWrite()
|
||||
{
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ abstract class DataExtension extends Extension
|
||||
*
|
||||
* See {@link DataObject::onBeforeDelete()} for context.
|
||||
*/
|
||||
public function onBeforeDelete()
|
||||
protected function onBeforeDelete()
|
||||
{
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ abstract class DataExtension extends Extension
|
||||
*
|
||||
* See {@link DataObject::onAfterDelete()} for context.
|
||||
*/
|
||||
public function onAfterDelete()
|
||||
protected function onAfterDelete()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -532,7 +532,7 @@ class Group extends DataObject
|
||||
return $validator;
|
||||
}
|
||||
|
||||
public function onBeforeWrite()
|
||||
protected function onBeforeWrite()
|
||||
{
|
||||
parent::onBeforeWrite();
|
||||
|
||||
@ -547,7 +547,7 @@ class Group extends DataObject
|
||||
$this->dedupeCode();
|
||||
}
|
||||
|
||||
public function onBeforeDelete()
|
||||
protected function onBeforeDelete()
|
||||
{
|
||||
parent::onBeforeDelete();
|
||||
|
||||
|
@ -733,7 +733,7 @@ class Member extends DataObject
|
||||
/**
|
||||
* Event handler called before writing to the database.
|
||||
*/
|
||||
public function onBeforeWrite()
|
||||
protected function onBeforeWrite()
|
||||
{
|
||||
// Remove any line-break or space characters accidentally added during a copy-paste operation
|
||||
if ($this->Email) {
|
||||
@ -818,7 +818,7 @@ class Member extends DataObject
|
||||
parent::onBeforeWrite();
|
||||
}
|
||||
|
||||
public function onAfterWrite()
|
||||
protected function onAfterWrite()
|
||||
{
|
||||
parent::onAfterWrite();
|
||||
|
||||
@ -829,7 +829,7 @@ class Member extends DataObject
|
||||
}
|
||||
}
|
||||
|
||||
public function onAfterDelete()
|
||||
protected function onAfterDelete()
|
||||
{
|
||||
parent::onAfterDelete();
|
||||
|
||||
|
@ -636,7 +636,7 @@ class Permission extends DataObject implements TemplateGlobalProvider, Resettabl
|
||||
}
|
||||
}
|
||||
|
||||
public function onBeforeWrite()
|
||||
protected function onBeforeWrite()
|
||||
{
|
||||
parent::onBeforeWrite();
|
||||
|
||||
|
@ -69,7 +69,7 @@ class PermissionRole extends DataObject
|
||||
return $fields;
|
||||
}
|
||||
|
||||
public function onAfterDelete()
|
||||
protected function onAfterDelete()
|
||||
{
|
||||
parent::onAfterDelete();
|
||||
|
||||
|
@ -25,7 +25,7 @@ class ControllerExtension extends Extension implements TestOnly
|
||||
/**
|
||||
* Called whenever there is an HTTP error
|
||||
*/
|
||||
public function onBeforeHTTPError()
|
||||
protected function onBeforeHTTPError()
|
||||
{
|
||||
self::$called_error = true;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ class ControllerExtension extends Extension
|
||||
* @param string $name
|
||||
* @param array $context
|
||||
*/
|
||||
public function updateFormActions(FieldList &$actions, Controller $controller, $name, $context = [])
|
||||
protected function updateFormActions(FieldList &$actions, Controller $controller, $name, $context = [])
|
||||
{
|
||||
// Add publish button if record is versioned
|
||||
if (empty($context['Record'])) {
|
||||
@ -59,7 +59,7 @@ class ControllerExtension extends Extension
|
||||
* @param string $name
|
||||
* @param array $context
|
||||
*/
|
||||
public function updateFormFields(FieldList &$fields, Controller $controller, $name, $context = [])
|
||||
protected function updateFormFields(FieldList &$fields, Controller $controller, $name, $context = [])
|
||||
{
|
||||
// Add preview link
|
||||
if (empty($context['Record'])) {
|
||||
|
@ -12,7 +12,7 @@ class FieldValidationExtension extends Extension implements TestOnly
|
||||
|
||||
protected bool $triggerTestValidationError = false;
|
||||
|
||||
public function updateValidationResult(bool &$result, Validator $validator)
|
||||
protected function updateValidationResult(bool &$result, Validator $validator)
|
||||
{
|
||||
if ($this->excludeFromValidation) {
|
||||
$result = true;
|
||||
|
@ -8,7 +8,7 @@ use SilverStripe\Dev\TestOnly;
|
||||
class TestExtension extends Extension implements TestOnly
|
||||
{
|
||||
|
||||
public function updateAttributes(&$attrs)
|
||||
protected function updateAttributes(&$attrs)
|
||||
{
|
||||
$attrs['extended'] = true;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ class ArticleExtension extends DataExtension implements TestOnly
|
||||
'ExtendedField' => 'Varchar'
|
||||
];
|
||||
|
||||
public function updateCMSFields(FieldList $fields)
|
||||
protected function updateCMSFields(FieldList $fields)
|
||||
{
|
||||
$fields->addFieldToTab(
|
||||
'Root.Main',
|
||||
|
@ -9,7 +9,7 @@ use SilverStripe\Forms\Tests\GridField\GridFieldTest\StadiumExtension;
|
||||
|
||||
class StadiumExtension extends DataExtension implements TestOnly
|
||||
{
|
||||
public function updateSearchableFields(&$fields)
|
||||
protected function updateSearchableFields(&$fields)
|
||||
{
|
||||
$fields['Type']['filter'] = new FulltextFilter();
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ class CMSFieldsBaseExtension extends DataExtension implements TestOnly
|
||||
'ExtendedFieldRemove' => 'Varchar(255)'
|
||||
];
|
||||
|
||||
public function updateCMSFields(FieldList $fields)
|
||||
protected function updateCMSFields(FieldList $fields)
|
||||
{
|
||||
$fields->addFieldToTab('Root.Test', new TextField('ExtendedFieldRemove'));
|
||||
$fields->addFieldToTab('Root.Test', new TextField('ExtendedFieldKeep'));
|
||||
|
@ -24,7 +24,7 @@ class Team_Extension extends DataExtension implements TestOnly
|
||||
return "extended dynamic field";
|
||||
}
|
||||
|
||||
public function augmentHydrateFields()
|
||||
protected function augmentHydrateFields()
|
||||
{
|
||||
return [
|
||||
'CustomHydratedField' => true,
|
||||
|
@ -7,7 +7,7 @@ use SilverStripe\Dev\TestOnly;
|
||||
|
||||
class ExtraKeysExtension extends Extension implements TestOnly
|
||||
{
|
||||
public function cacheKeyComponent(): string
|
||||
protected function cacheKeyComponent(): string
|
||||
{
|
||||
return 'extra-key';
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ use SilverStripe\Security\RememberLoginHash;
|
||||
use SilverStripe\Security\Security;
|
||||
use SilverStripe\Security\Tests\MemberTest\FieldsExtension;
|
||||
use SilverStripe\SessionManager\Models\LoginSession;
|
||||
use ReflectionMethod;
|
||||
|
||||
class MemberTest extends FunctionalTest
|
||||
{
|
||||
@ -1605,7 +1606,9 @@ class MemberTest extends FunctionalTest
|
||||
$this->assertFalse($fail, 'Missing FirstName');
|
||||
|
||||
$ext = new MemberTest\ValidatorExtension();
|
||||
$ext->updateValidator($validator);
|
||||
$method = new ReflectionMethod(MemberTest\ValidatorExtension::class, 'updateValidator');
|
||||
$method->setAccessible(true);
|
||||
$method->invokeArgs($ext, [$validator]);
|
||||
|
||||
$pass = $validator->php(
|
||||
[
|
||||
|
@ -10,7 +10,7 @@ use SilverStripe\ORM\DataExtension;
|
||||
*/
|
||||
class AlwaysFailExtension extends DataExtension implements TestOnly
|
||||
{
|
||||
public function updatePHP($data, $form)
|
||||
protected function updatePHP($data, $form)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ use SilverStripe\ORM\ValidationResult;
|
||||
*/
|
||||
class ExtendedChangePasswordExtension extends DataExtension implements TestOnly
|
||||
{
|
||||
public function onBeforeChangePassword($newPassword, $valid)
|
||||
protected function onBeforeChangePassword($newPassword, $valid)
|
||||
{
|
||||
$valid->addError('Extension failed to handle Mary changing her password');
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ use SilverStripe\ORM\DataExtension;
|
||||
|
||||
class FieldsExtension extends DataExtension implements TestOnly
|
||||
{
|
||||
public function updateCMSFields(FieldList $fields)
|
||||
protected function updateCMSFields(FieldList $fields)
|
||||
{
|
||||
$fields->addFieldToTab('Root.Main', new TextField('TestMemberField', 'Test'));
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ use SilverStripe\ORM\DataExtension;
|
||||
*/
|
||||
class SurnameMustMatchFirstNameExtension extends DataExtension implements TestOnly
|
||||
{
|
||||
public function updatePHP($data, $form)
|
||||
protected function updatePHP($data, $form)
|
||||
{
|
||||
return $data['FirstName'] == $data['Surname'];
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ use SilverStripe\ORM\DataExtension;
|
||||
class ValidatorExtension extends DataExtension implements TestOnly
|
||||
{
|
||||
|
||||
public function updateValidator(&$validator)
|
||||
protected function updateValidator($validator)
|
||||
{
|
||||
$validator->addRequiredField('Surname');
|
||||
$validator->removeRequiredField('FirstName');
|
||||
|
Loading…
x
Reference in New Issue
Block a user