mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-01 13:48:37 +02:00
MINOR Add forceFullTree param for getting a complete tree (SSF-110)
This commit is contained in:
parent
23e7aeeea4
commit
18e5dec680
@ -203,12 +203,11 @@ class TreeDropdownField extends FormField {
|
|||||||
$isSubTree = false;
|
$isSubTree = false;
|
||||||
|
|
||||||
$this->search = Convert::Raw2SQL($request->requestVar('search'));
|
$this->search = Convert::Raw2SQL($request->requestVar('search'));
|
||||||
|
|
||||||
$ID = (is_numeric($request->latestparam('ID'))) ? (int)$request->latestparam('ID') : (int)$request->requestVar('ID');
|
$ID = (is_numeric($request->latestparam('ID'))) ? (int)$request->latestparam('ID') : (int)$request->requestVar('ID');
|
||||||
if($ID) {
|
$forceFullTree = $request->requestVar('forceFullTree')?$request->requestVar('forceFullTree'):false;
|
||||||
|
if($ID && !$forceFullTree) {
|
||||||
$obj = DataObject::get_by_id($this->sourceObject, $ID);
|
$obj = DataObject::get_by_id($this->sourceObject, $ID);
|
||||||
$isSubTree = true;
|
$isSubTree = true;
|
||||||
|
|
||||||
if(!$obj) {
|
if(!$obj) {
|
||||||
throw new Exception (
|
throw new Exception (
|
||||||
"TreeDropdownField->tree(): the object #$ID of type $this->sourceObject could not be found"
|
"TreeDropdownField->tree(): the object #$ID of type $this->sourceObject could not be found"
|
||||||
@ -240,7 +239,6 @@ class TreeDropdownField extends FormField {
|
|||||||
$obj->markToExpose($this->objectForKey($value));
|
$obj->markToExpose($this->objectForKey($value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$eval = '"<li id=\"selector-' . $this->getName() . '-{$child->' . $this->keyField . '}\" data-id=\"$child->' . $this->keyField . '\" class=\"class-$child->class"' .
|
$eval = '"<li id=\"selector-' . $this->getName() . '-{$child->' . $this->keyField . '}\" data-id=\"$child->' . $this->keyField . '\" class=\"class-$child->class"' .
|
||||||
' . $child->markingClasses() . "\"><a rel=\"$child->ID\">" . $child->' . $this->labelField . ' . "</a>"';
|
' . $child->markingClasses() . "\"><a rel=\"$child->ID\">" . $child->' . $this->labelField . ' . "</a>"';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user