Skip to content

Commit

Permalink
API Standardise extension hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Aug 19, 2024
1 parent 1bf5db0 commit cb405cc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion code/Controller/AssetAdminFieldsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
10 changes: 5 additions & 5 deletions tests/php/Controller/AssetAdminTest/FileExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions tests/php/Controller/AssetAdminTest/FolderExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions tests/php/Forms/FileFormBuilderTest/FileExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit cb405cc

Please sign in to comment.