mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
Added Subsite::get_from_all_subsites
This commit is contained in:
parent
3ab4cb3780
commit
edb82dd8a3
@ -8,7 +8,7 @@ class SiteTreeSubsites extends DataObjectDecorator {
|
||||
'((Company Name))' => 'Title'
|
||||
);
|
||||
|
||||
protected static $template_fields = array(
|
||||
static $template_fields = array(
|
||||
"URLSegment",
|
||||
"Title",
|
||||
"MenuTitle",
|
||||
@ -44,6 +44,8 @@ class SiteTreeSubsites extends DataObjectDecorator {
|
||||
* Update any requests to limit the results to the current site
|
||||
*/
|
||||
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(strpos($query->where[0], ".`ID` = ") === false && strpos($query->where[0], ".ID = ") === false) {
|
||||
|
||||
|
@ -3,6 +3,8 @@
|
||||
* A dynamically created subdomain. SiteTree objects can now belong to a subdomain
|
||||
*/
|
||||
class Subsite extends DataObject implements PermissionProvider {
|
||||
|
||||
static $disable_subsite_filter = false;
|
||||
|
||||
static $default_sort = 'Title';
|
||||
|
||||
@ -323,6 +325,13 @@ SQL;
|
||||
'SUBSITE_EDIT' => 'Edit Sub-site Details',
|
||||
);
|
||||
}
|
||||
|
||||
static function get_from_all_subsites($className, $filter = "", $sort = "", $join = "", $limit = "") {
|
||||
self::$disable_subsite_filter = true;
|
||||
$result = DataObject::get($className, $filter, $sort, $join, $limit);
|
||||
self::$disable_subsite_filter = false;
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user