mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
ef4d539a12
Fixed a few missed strict errors Applied patch from kmayo to fix issues with SubsiteAdminTest.php Fixed issue causing the url segments of subsites created from a template to add -2 to the end Fixed undefined method TotalItems() on datalist for the SubsiteTest Fixed failure on SubsiteTest because DataObject::get_one() now returns boolean false instead of null when no result is found Fixed failure on SubsitesVirtualPageTest caused by Versioned::get_one_by_stage() returning null instead of false Fixed failure caused by the contact-us page existing on subsite 2 Merged another patch from kmayo Force main site to be on, for some reason it gets hidden in some cases i.e. refreshing the cms while editing a page
40 lines
847 B
PHP
40 lines
847 B
PHP
<?php
|
|
/**
|
|
* Wraps around a TreedropdownField to add ability for temporary
|
|
* switching of subsite sessions.
|
|
*
|
|
* @package subsites
|
|
*/
|
|
class SubsitesTreeDropdownField extends TreeDropdownField {
|
|
|
|
protected $subsiteID = 0;
|
|
|
|
protected $extraClasses = array('SubsitesTreeDropdownField');
|
|
|
|
function Field($properties = array()) {
|
|
$html = parent::Field($properties);
|
|
|
|
Requirements::javascript('subsites/javascript/SubsitesTreeDropdownField.js');
|
|
|
|
return $html;
|
|
}
|
|
|
|
function setSubsiteID($id) {
|
|
$this->subsiteID = $id;
|
|
}
|
|
|
|
function getSubsiteID() {
|
|
return $this->subsiteID;
|
|
}
|
|
|
|
function tree(SS_HTTPRequest $request) {
|
|
$oldSubsiteID = Session::get('SubsiteID');
|
|
Session::set('SubsiteID', $this->subsiteID);
|
|
|
|
$results = parent::tree($request);
|
|
|
|
Session::set('SubsiteID', $oldSubsiteID);
|
|
|
|
return $results;
|
|
}
|
|
} |