API Standardise extension hooks (#2989)

This commit is contained in:
Guy Sartorelli 2024-08-27 15:39:17 +12:00 committed by GitHub
parent 2d158e9d77
commit 48c64e310b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 15 additions and 15 deletions

View File

@ -26,7 +26,7 @@ class LeftAndMainPageIconsExtension extends Extension implements Flushable
* @throws InvalidArgumentException * @throws InvalidArgumentException
* @throws ReflectionException * @throws ReflectionException
*/ */
public function init() protected function onInit()
{ {
Requirements::customCSS($this->generatePageIconsCss(), CMSMain::PAGE_ICONS_ID); Requirements::customCSS($this->generatePageIconsCss(), CMSMain::PAGE_ICONS_ID);
} }

View File

@ -1494,7 +1494,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
]; ];
} }
$this->extend('MetaComponents', $tags); $this->extend('updateMetaComponents', $tags);
return $tags; return $tags;
} }
@ -1598,7 +1598,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
$tagString .= $this->obj('ExtraMeta')->forTemplate(); $tagString .= $this->obj('ExtraMeta')->forTemplate();
} }
$this->extend('MetaTags', $tagString); $this->extend('updateMetaTags', $tagString);
return $tagString; return $tagString;
} }

View File

@ -70,7 +70,7 @@ abstract class SiteTreeExtension extends DataExtension
* logged in user * logged in user
* @return boolean|null Return false to deny rights, or null to yield to default * @return boolean|null Return false to deny rights, or null to yield to default
*/ */
public function canAddChildren($member) protected function canAddChildren($member)
{ {
} }
@ -83,7 +83,7 @@ abstract class SiteTreeExtension extends DataExtension
* logged in user * logged in user
* @return boolean|null Return false to deny rights, or null to yield to default * @return boolean|null Return false to deny rights, or null to yield to default
*/ */
public function canPublish($member) protected function canPublish($member)
{ {
} }
@ -100,7 +100,7 @@ abstract class SiteTreeExtension extends DataExtension
* (Legacy support) If this is true, then do not reduce the 'home' urlsegment * (Legacy support) If this is true, then do not reduce the 'home' urlsegment
* to an empty link * to an empty link
*/ */
public function updateRelativeLink(&$link, $base, $action) protected function updateRelativeLink(&$link, $base, $action)
{ {
} }
} }

View File

@ -10,27 +10,27 @@ use SilverStripe\ORM\DataExtension;
*/ */
class SiteTreeTest_AdminDeniedExtension extends DataExtension implements TestOnly class SiteTreeTest_AdminDeniedExtension extends DataExtension implements TestOnly
{ {
public function canCreate($member) protected function canCreate($member)
{ {
return false; return false;
} }
public function canEdit($member) protected function canEdit($member)
{ {
return false; return false;
} }
public function canDelete($member) protected function canDelete($member)
{ {
return false; return false;
} }
public function canAddChildren() protected function canAddChildren()
{ {
return false; return false;
} }
public function canView() protected function canView()
{ {
return false; return false;
} }

View File

@ -10,12 +10,12 @@ class SiteTreeTest_ExtensionA extends SiteTreeExtension implements TestOnly
{ {
public static $can_publish = true; public static $can_publish = true;
public function canPublish($member) protected function canPublish($member)
{ {
return static::$can_publish; return static::$can_publish;
} }
public function updateLink(&$link, $action = null) protected function updateLink(&$link, $action = null)
{ {
$link = Controller::join_links($link, '?extra=1'); $link = Controller::join_links($link, '?extra=1');
} }

View File

@ -10,12 +10,12 @@ class SiteTreeTest_ExtensionB extends SiteTreeExtension implements TestOnly
{ {
public static $can_publish = true; public static $can_publish = true;
public function canPublish($member) protected function canPublish($member)
{ {
return static::$can_publish; return static::$can_publish;
} }
public function updateLink(&$link, $action = null) protected function updateLink(&$link, $action = null)
{ {
$link = Controller::join_links('http://www.updatedhost.com', $link); $link = Controller::join_links('http://www.updatedhost.com', $link);
} }