mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
FIX: Fixes #7181 to config system for userland config of node display limits.
This commit is contained in:
parent
fc35eff13f
commit
59b28f7d5b
@ -50,6 +50,13 @@ class TreeDropdownField extends FormField {
|
|||||||
'tree'
|
'tree'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @config
|
||||||
|
* @var int
|
||||||
|
* @see {@link Hierarchy::$node_threshold_total}.
|
||||||
|
*/
|
||||||
|
private static $node_threshold_total = 30;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
@ -303,7 +310,8 @@ class TreeDropdownField extends FormField {
|
|||||||
if ($this->filterCallback || $this->search != "" )
|
if ($this->filterCallback || $this->search != "" )
|
||||||
$obj->setMarkingFilterFunction(array($this, "filterMarking"));
|
$obj->setMarkingFilterFunction(array($this, "filterMarking"));
|
||||||
|
|
||||||
$obj->markPartialTree($nodeCountThreshold = 30, $context = null,
|
$nodeCountThreshold = Config::inst()->get('TreeDropdownField', 'node_threshold_total');
|
||||||
|
$obj->markPartialTree($nodeCountThreshold, $context = null,
|
||||||
$this->childrenMethod, $this->numChildrenMethod);
|
$this->childrenMethod, $this->numChildrenMethod);
|
||||||
|
|
||||||
// allow to pass values to be selected within the ajax request
|
// allow to pass values to be selected within the ajax request
|
||||||
|
@ -218,10 +218,12 @@ class Hierarchy extends DataExtension {
|
|||||||
* @param int $nodeCountThreshold See {@link getChildrenAsUL()}
|
* @param int $nodeCountThreshold See {@link getChildrenAsUL()}
|
||||||
* @return int The actual number of nodes marked.
|
* @return int The actual number of nodes marked.
|
||||||
*/
|
*/
|
||||||
public function markPartialTree($nodeCountThreshold = 30, $context = null,
|
public function markPartialTree($nodeCountThreshold = null, $context = null,
|
||||||
$childrenMethod = "AllChildrenIncludingDeleted", $numChildrenMethod = "numChildren") {
|
$childrenMethod = "AllChildrenIncludingDeleted", $numChildrenMethod = "numChildren") {
|
||||||
|
|
||||||
if(!is_numeric($nodeCountThreshold)) $nodeCountThreshold = 30;
|
if(!is_numeric($nodeCountThreshold)) {
|
||||||
|
$nodeCountThreshold = Config::inst()->get('Hierarchy', 'node_threshold_total');
|
||||||
|
}
|
||||||
|
|
||||||
$this->markedNodes = array($this->owner->ID => $this->owner);
|
$this->markedNodes = array($this->owner->ID => $this->owner);
|
||||||
$this->owner->markUnexpanded();
|
$this->owner->markUnexpanded();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user