mirror of
https://github.com/wilr/silverstripe-googlesitemaps.git
synced 2024-10-22 11:05:48 +02:00
Support falsey values in alter (Fixes #152)
This commit is contained in:
parent
4d131b06ac
commit
710b8c3518
@ -52,13 +52,16 @@ class GoogleSitemapExtension extends DataExtension
|
||||
return false;
|
||||
}
|
||||
|
||||
// Allow override. In this case, since this can return multiple results, we'll use an "and" based policy.
|
||||
// That is if any value is false then the current value will be false. Only only if all are true will we
|
||||
// then return true.
|
||||
// Allow override. invokeWithExtensions will either return a single result (true|false) if defined on the object
|
||||
// or an array if on extensions.
|
||||
$override = $this->owner->invokeWithExtensions('alterCanIncludeInGoogleSitemap', $can);
|
||||
|
||||
if ($override) {
|
||||
$can = min($override, $can);
|
||||
if ($override !== null) {
|
||||
if (is_array($override)) {
|
||||
$can = min($override, $can);
|
||||
} else {
|
||||
$can = $override;
|
||||
}
|
||||
}
|
||||
|
||||
return $can;
|
||||
|
Loading…
Reference in New Issue
Block a user