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 e58c388 commit 3120d21
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion code/Controllers/LeftAndMainPageIconsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class LeftAndMainPageIconsExtension extends Extension implements Flushable
* @throws InvalidArgumentException
* @throws ReflectionException
*/
public function init()
protected function onInit()
{
Requirements::customCSS($this->generatePageIconsCss(), CMSMain::PAGE_ICONS_ID);
}
Expand Down
4 changes: 2 additions & 2 deletions code/Model/SiteTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -1509,7 +1509,7 @@ public function MetaComponents()
];
}

$this->extend('MetaComponents', $tags);
$this->extend('updateMetaComponents', $tags);

return $tags;
}
Expand Down Expand Up @@ -1613,7 +1613,7 @@ public function MetaTags($includeTitle = true)
$tagString .= $this->obj('ExtraMeta')->forTemplate();
}

$this->extend('MetaTags', $tagString);
$this->extend('updateMetaTags', $tagString);

return $tagString;
}
Expand Down
6 changes: 3 additions & 3 deletions code/Model/SiteTreeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected function onAfterUnpublish()
* logged in user
* @return boolean|null Return false to deny rights, or null to yield to default
*/
public function canAddChildren($member)
protected function canAddChildren($member)
{
}

Expand All @@ -69,7 +69,7 @@ public function canAddChildren($member)
* logged in user
* @return boolean|null Return false to deny rights, or null to yield to default
*/
public function canPublish($member)
protected function canPublish($member)
{
}

Expand All @@ -86,7 +86,7 @@ public function canPublish($member)
* (Legacy support) If this is true, then do not reduce the 'home' urlsegment
* to an empty link
*/
public function updateRelativeLink(&$link, $base, $action)
protected function updateRelativeLink(&$link, $base, $action)
{
}
}
10 changes: 5 additions & 5 deletions tests/php/Model/SiteTreeTest_AdminDeniedExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@
*/
class SiteTreeTest_AdminDeniedExtension extends DataExtension implements TestOnly
{
public function canCreate($member)
protected function canCreate($member)
{
return false;
}

public function canEdit($member)
protected function canEdit($member)
{
return false;
}

public function canDelete($member)
protected function canDelete($member)
{
return false;
}

public function canAddChildren()
protected function canAddChildren()
{
return false;
}

public function canView()
protected function canView()
{
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/php/Model/SiteTreeTest_ExtensionA.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ class SiteTreeTest_ExtensionA extends SiteTreeExtension implements TestOnly
{
public static $can_publish = true;

public function canPublish($member)
protected function canPublish($member)
{
return static::$can_publish;
}

public function updateLink(&$link, $action = null)
protected function updateLink(&$link, $action = null)
{
$link = Controller::join_links($link, '?extra=1');
}
Expand Down
4 changes: 2 additions & 2 deletions tests/php/Model/SiteTreeTest_ExtensionB.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ class SiteTreeTest_ExtensionB extends SiteTreeExtension implements TestOnly
{
public static $can_publish = true;

public function canPublish($member)
protected function canPublish($member)
{
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);
}
Expand Down

0 comments on commit 3120d21

Please sign in to comment.