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 #591

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 src/Extensions/FileSubsites.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected function onAfterUpload()
$this->owner->write();
}

public function canEdit($member = null)
protected function canEdit($member = null)
{
// Opt out of making opinions if no subsite ID is set yet
if (!$this->owner->SubsiteID) {
Expand Down
2 changes: 1 addition & 1 deletion src/Extensions/GroupSubsites.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class GroupSubsites extends DataExtension implements PermissionProvider
/**
* Migrations for GroupSubsites data.
*/
public function requireDefaultRecords()
protected function onRequireDefaultRecords()
{
if (!$this->owner) {
return;
Expand Down
8 changes: 4 additions & 4 deletions src/Extensions/LeftAndMainSubsites.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class LeftAndMainSubsites extends LeftAndMainExtension
*/
private static $treats_subsite_0_as_global = false;

public function init()
protected function onInit()
{
Requirements::css('silverstripe/subsites:client/dist/styles/LeftAndMain_Subsites.css');
Requirements::javascript('silverstripe/subsites:client/dist/js/LeftAndMain_Subsites.js');
Expand Down Expand Up @@ -223,7 +223,7 @@ public function shouldChangeSubsite($adminClass, $recordSubsiteID, $currentSubsi
*
* @param Member $member
*/
public function canAccess(Member $member = null)
protected function canAccess(Member $member = null)
{
if (!$member) {
$member = Security::getCurrentUser();
Expand Down Expand Up @@ -253,7 +253,7 @@ public function canAccess(Member $member = null)
*/
public function alternateAccessCheck(Member $member = null)
{
return $this->owner->canAccess($member);
return $this->canAccess($member);
}

/**
Expand Down Expand Up @@ -345,7 +345,7 @@ protected function onBeforeInit()

// SECOND, check if we need to change subsites due to lack of permissions.

if (!$this->owner->canAccess()) {
if (!$this->canAccess()) {
$member = Security::getCurrentUser();

// Current section is not accessible, try at least to stick to the same subsite.
Expand Down
12 changes: 6 additions & 6 deletions src/Extensions/SiteTreeSubsites.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ protected function alternateSiteConfig()
* @param Member|null $member
* @return bool|null
*/
public function canEdit($member = null)
protected function canEdit($member = null)
{
if (!$member) {
$member = Security::getCurrentUser();
Expand Down Expand Up @@ -351,7 +351,7 @@ public function canEdit($member = null)
* @param null $member
* @return bool
*/
public function canDelete($member = null)
protected function canDelete($member = null)
{
if (!$member && $member !== false) {
$member = Security::getCurrentUser();
Expand All @@ -364,7 +364,7 @@ public function canDelete($member = null)
* @param null $member
* @return bool
*/
public function canAddChildren($member = null)
protected function canAddChildren($member = null)
{
if (!$member && $member !== false) {
$member = Security::getCurrentUser();
Expand All @@ -377,7 +377,7 @@ public function canAddChildren($member = null)
* @param Member|null $member
* @return bool|null
*/
public function canPublish($member = null)
protected function canPublish($member = null)
{
if (!$member && $member !== false) {
$member = Security::getCurrentUser();
Expand Down Expand Up @@ -445,7 +445,7 @@ protected function updatePreviewLink(&$link, $action = null)
* @param $tags
* @return string
*/
public function MetaTags(&$tags)
protected function updateMetaTags(&$tags)
{
if ($this->owner->SubsiteID) {
$tags .= '<meta name="x-subsite-id" content="' . $this->owner->SubsiteID . "\" />\n";
Expand Down Expand Up @@ -527,7 +527,7 @@ protected function cacheKeyComponent()
* @param Member $member
* @return boolean|null
*/
public function canCreate($member = null)
protected function canCreate($member = null)
{
// Typically called on a singleton, so we're not using the Subsite() relation
$subsite = Subsite::currentSubsite();
Expand Down
Loading