mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 09:05:55 +00:00
Merge pull request #63 from mateusz/top-level
BUG Switch the subsite on GET parameter only.
This commit is contained in:
commit
3d59f10331
@ -11,14 +11,14 @@ class LeftAndMainSubsites extends Extension {
|
||||
Requirements::javascript('subsites/javascript/LeftAndMain_Subsites.js');
|
||||
Requirements::javascript('subsites/javascript/VirtualPage_Subsites.js');
|
||||
|
||||
if(isset($_REQUEST['SubsiteID'])) {
|
||||
if(isset($_GET['SubsiteID'])) {
|
||||
// Clear current page when subsite changes (or is set for the first time)
|
||||
if(!Session::get('SubsiteID') || $_REQUEST['SubsiteID'] != Session::get('SubsiteID')) {
|
||||
if(!Session::get('SubsiteID') || $_GET['SubsiteID'] != Session::get('SubsiteID')) {
|
||||
Session::clear("{$this->owner->class}.currentPage");
|
||||
}
|
||||
|
||||
// Update current subsite in session
|
||||
Subsite::changeSubsite($_REQUEST['SubsiteID']);
|
||||
Subsite::changeSubsite($_GET['SubsiteID']);
|
||||
|
||||
//Redirect to clear the current page
|
||||
$this->owner->redirect('admin/pages');
|
||||
|
@ -273,13 +273,13 @@ JS;
|
||||
*
|
||||
* You can simulate subsite access without creating virtual hosts by appending ?SubsiteID=<ID> to the request.
|
||||
*
|
||||
* @todo Pass $request object from controller so we don't have to rely on $_REQUEST
|
||||
* @todo Pass $request object from controller so we don't have to rely on $_GET
|
||||
*
|
||||
* @param boolean $cache
|
||||
* @return int ID of the current subsite instance
|
||||
*/
|
||||
static function currentSubsiteID() {
|
||||
if(isset($_REQUEST['SubsiteID'])) $id = (int)$_REQUEST['SubsiteID'];
|
||||
if(isset($_GET['SubsiteID'])) $id = (int)$_GET['SubsiteID'];
|
||||
else $id = Session::get('SubsiteID');
|
||||
|
||||
if($id === NULL) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user