Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Standardise extension hooks #2989

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -1494,7 +1494,7 @@ public function MetaComponents()
];
}

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

return $tags;
}
Expand Down Expand Up @@ -1598,7 +1598,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 @@ -70,7 +70,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 @@ -83,7 +83,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 @@ -100,7 +100,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
Loading