mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
Made GroupSubsites respect disable_subsite_filter, and added an accessor method for 3rd parties to use this functionality.
This commit is contained in:
parent
62ec1d1a6f
commit
46edecfca2
@ -25,6 +25,8 @@ class GroupSubsites extends DataObjectDecorator {
|
|||||||
* Update any requests to limit the results to the current site
|
* Update any requests to limit the results to the current site
|
||||||
*/
|
*/
|
||||||
function augmentSQL(SQLQuery &$query) {
|
function augmentSQL(SQLQuery &$query) {
|
||||||
|
if(Subsite::$disable_subsite_filter) return;
|
||||||
|
|
||||||
// If you're querying by ID, ignore the sub-site - this is a bit ugly...
|
// If you're querying by ID, ignore the sub-site - this is a bit ugly...
|
||||||
if(!$query->where || (strpos($query->where[0], ".`ID` = ") === false && strpos($query->where[0], ".ID = ") === false)) {
|
if(!$query->where || (strpos($query->where[0], ".`ID` = ") === false && strpos($query->where[0], ".ID = ") === false)) {
|
||||||
|
|
||||||
|
@ -356,6 +356,13 @@ SQL;
|
|||||||
self::$disable_subsite_filter = false;
|
self::$disable_subsite_filter = false;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable the sub-site filtering; queries will select from all subsites
|
||||||
|
*/
|
||||||
|
static function disable_subsite_filter($disabled = true) {
|
||||||
|
self::$disable_subsite_filter = $disabled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user