mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Clean up code
Just making it a little clearer what's going on by changing the variable names and removing some redundant code.
This commit is contained in:
parent
9f01cce694
commit
df0ce184bf
@ -1719,20 +1719,18 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
||||
$filter['"SiteTree"."ParentID"'] = $this->ParentID ? $this->ParentID : 0;
|
||||
}
|
||||
|
||||
$votes = array_filter(
|
||||
// If any of the extensions return `0` consider the segment invalid
|
||||
$extensionResponses = array_filter(
|
||||
(array)$this->extend('augmentValidURLSegment'),
|
||||
function($v) {return !is_null($v);}
|
||||
function($response) {return !is_null($response);}
|
||||
);
|
||||
if($votes) {
|
||||
return min($votes);
|
||||
if($extensionResponses) {
|
||||
return min($extensionResponses);
|
||||
}
|
||||
|
||||
// Check existence
|
||||
$existingPage = DataObject::get_one(self::class, $filter);
|
||||
if ($existingPage) return false;
|
||||
|
||||
return !($existingPage);
|
||||
}
|
||||
return !DataObject::get(self::class, $filter)->exists();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a URL segment based on the title provided.
|
||||
|
Loading…
Reference in New Issue
Block a user