mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
BUGFIX allow Subsite Virtual Pages to share a URL Segment (from r82346)
This commit is contained in:
parent
4801838dd0
commit
40ff605fbf
@ -59,8 +59,7 @@ class SiteTreeSubsites extends DataObjectDecorator {
|
|||||||
else $q='`';
|
else $q='`';
|
||||||
|
|
||||||
// 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], ".{$q}ID{$q} = ") === false && strpos($query->where[0], ".{$q}ID{$q} = ") === false && strpos($query->where[0], ".{$q}ID{$q} = ") === false && strpos($query->where[0], "{$q}ID{$q} = ") !== 0)) {
|
if (!$query->where || (!preg_match('/\.(\'|"|`|)ID(\'|"|`|)( ?)=/', $query->where[0]))) {
|
||||||
|
|
||||||
$context = DataObject::context_obj();
|
$context = DataObject::context_obj();
|
||||||
if($context && is_numeric($context->SubsiteID)) $subsiteID = (int) $context->SubsiteID;
|
if($context && is_numeric($context->SubsiteID)) $subsiteID = (int) $context->SubsiteID;
|
||||||
else $subsiteID = (int) Subsite::currentSubsiteID();
|
else $subsiteID = (int) Subsite::currentSubsiteID();
|
||||||
|
@ -65,18 +65,6 @@ class SubsitesVirtualPage extends VirtualPage {
|
|||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onBeforeWrite() {
|
|
||||||
Subsite::$disable_subsite_filter = true;
|
|
||||||
|
|
||||||
parent::onBeforeWrite();
|
|
||||||
}
|
|
||||||
|
|
||||||
function onAfterWrite() {
|
|
||||||
Subsite::$disable_subsite_filter = false;
|
|
||||||
|
|
||||||
parent::onAfterWrite();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class SubsitesVirtualPage_Controller extends VirtualPage_Controller {
|
class SubsitesVirtualPage_Controller extends VirtualPage_Controller {
|
||||||
|
Loading…
Reference in New Issue
Block a user