From cb405cc997eddd648d295a65cceb55673298fef7 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Mon, 19 Aug 2024 09:45:53 +1200 Subject: [PATCH] API Standardise extension hooks --- code/Controller/AssetAdminFieldsExtension.php | 2 +- tests/php/Controller/AssetAdminTest/FileExtension.php | 10 +++++----- .../php/Controller/AssetAdminTest/FolderExtension.php | 8 ++++---- tests/php/Forms/FileFormBuilderTest/FileExtension.php | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/code/Controller/AssetAdminFieldsExtension.php b/code/Controller/AssetAdminFieldsExtension.php index 9b4ebe261..27a5aa450 100644 --- a/code/Controller/AssetAdminFieldsExtension.php +++ b/code/Controller/AssetAdminFieldsExtension.php @@ -11,7 +11,7 @@ */ class AssetAdminFieldsExtension extends Extension { - public function init() + protected function onInit() { Requirements::add_i18n_javascript('silverstripe/asset-admin:client/lang', false); Requirements::javascript('silverstripe/asset-admin:client/dist/js/bundle.js'); diff --git a/tests/php/Controller/AssetAdminTest/FileExtension.php b/tests/php/Controller/AssetAdminTest/FileExtension.php index ae55b11b8..1c5ae9737 100644 --- a/tests/php/Controller/AssetAdminTest/FileExtension.php +++ b/tests/php/Controller/AssetAdminTest/FileExtension.php @@ -7,28 +7,28 @@ class FileExtension extends DataExtension implements TestOnly { - public function canView($member = null) + protected function canView($member = null) { if ($this->owner->Name === 'disallowCanView.txt') { return false; } } - public function canEdit($member = null) + protected function canEdit($member = null) { if ($this->owner->Name === 'disallowCanEdit.txt') { return false; } } - public function canDelete($member = null) + protected function canDelete($member = null) { if ($this->owner->Name === 'disallowCanDelete.txt') { return false; } } - public function canArchive($member = null) + protected function canArchive($member = null) { if ($this->owner->Name === 'disallowCanDelete.txt') { return false; @@ -37,7 +37,7 @@ public function canArchive($member = null) } - public function canCreate($member = null, $context = []) + protected function canCreate($member = null, $context = []) { if (isset($context['Parent']) && $context['Parent']->Name === 'disallowCanAddChildren') { return false; diff --git a/tests/php/Controller/AssetAdminTest/FolderExtension.php b/tests/php/Controller/AssetAdminTest/FolderExtension.php index cfeb5d1a3..7e3713454 100644 --- a/tests/php/Controller/AssetAdminTest/FolderExtension.php +++ b/tests/php/Controller/AssetAdminTest/FolderExtension.php @@ -7,28 +7,28 @@ class FolderExtension extends DataExtension implements TestOnly { - public function canView($member = null, $context = array()) + protected function canView($member = null, $context = array()) { if ($this->owner->Name === 'disallowCanView') { return false; } } - public function canEdit($member = null, $context = array()) + protected function canEdit($member = null, $context = array()) { if ($this->owner->Name === 'disallowCanEdit') { return false; } } - public function canDelete($member = null, $context = array()) + protected function canDelete($member = null, $context = array()) { if ($this->owner->Name === 'disallowCanDelete') { return false; } } - public function canCreate($member = null, $context = array()) + protected function canCreate($member = null, $context = array()) { if (isset($context['Name']) && $context['Name'] === 'disallowCanCreate') { return false; diff --git a/tests/php/Forms/FileFormBuilderTest/FileExtension.php b/tests/php/Forms/FileFormBuilderTest/FileExtension.php index 89dbde036..e7e9799d7 100644 --- a/tests/php/Forms/FileFormBuilderTest/FileExtension.php +++ b/tests/php/Forms/FileFormBuilderTest/FileExtension.php @@ -17,22 +17,22 @@ class FileExtension extends DataExtension implements TestOnly public static $canUnpublish = true; public static $canEdit = true; - public function canDelete($member) + protected function canDelete($member) { return FileExtension::$canDelete; } - public function canPublish($member = null) + protected function canPublish($member = null) { return FileExtension::$canPublish; } - public function canUnpublish($member = null) + protected function canUnpublish($member = null) { return FileExtension::$canUnpublish; } - public function canEdit($member = null) + protected function canEdit($member = null) { return FileExtension::$canEdit; }