mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
BUGFIX SubsitesTreeDropdownField::getsubtree() failed because it was removed from TreeDropdownField in r88482
This commit is contained in:
parent
59c3dd1ea2
commit
7b6b35328c
@ -38,15 +38,23 @@ class SubsitesTreeDropdownField extends TreeDropdownField {
|
||||
return $results;
|
||||
}
|
||||
|
||||
function getsubtree() {
|
||||
public function getsubtree(SS_HTTPRequest $request) {
|
||||
$oldSubsiteID = Session::get('SubsiteID');
|
||||
Session::set('SubsiteID', $this->subsiteID);
|
||||
|
||||
$results = parent::getsubtree();
|
||||
|
||||
|
||||
$obj = $this->objectForKey($_REQUEST['SubtreeRootID']);
|
||||
|
||||
if(!$obj) user_error("Can't find database record $this->sourceObject with $this->keyField = $_REQUEST[SubtreeRootID]", E_USER_ERROR);
|
||||
|
||||
if($this->filterFunc) $obj->setMarkingFilterFunction($this->filterFunc);
|
||||
else if($this->sourceObject == 'Folder') $obj->setMarkingFilter('ClassName', 'Folder');
|
||||
$obj->markPartialTree();
|
||||
|
||||
$eval = '"<li id=\"selector-' . $this->name . '-$child->' . $this->keyField . '\" class=\"$child->class" . $child->markingClasses() . "\"><a>" . $child->' . $this->labelField . ' . "</a>"';
|
||||
$tree = $obj->getChildrenAsUL("", $eval, null, true);
|
||||
echo substr(trim($tree), 4,-5);
|
||||
|
||||
Session::set('SubsiteID', $oldSubsiteID);
|
||||
|
||||
return $results;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user