Merge pull request #7250 from phptek/issue/7181
FIX: Fixes #7181 Use config system for userland config of node_threshold_total
This commit is contained in:
commit
9ea09376eb
|
@ -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…
Reference in New Issue