From 1fedc5fc10b6a1d2af417a051d7fe6bd8182b191 Mon Sep 17 00:00:00 2001 From: Lee Bradley Date: Mon, 27 Nov 2017 21:09:27 +0000 Subject: [PATCH] API Make `CMSMain::getSiteTreeFor()` default to `null` nodeCount (#2029) --- code/Controllers/CMSMain.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/Controllers/CMSMain.php b/code/Controllers/CMSMain.php index d8037e6f..84ca5255 100644 --- a/code/Controllers/CMSMain.php +++ b/code/Controllers/CMSMain.php @@ -21,6 +21,7 @@ use SilverStripe\Control\Director; use SilverStripe\Control\HTTPRequest; use SilverStripe\Control\HTTPResponse; use SilverStripe\Control\HTTPResponse_Exception; +use SilverStripe\Core\Config\Config; use SilverStripe\Core\Convert; use SilverStripe\Core\Environment; use SilverStripe\Core\Injector\Injector; @@ -52,6 +53,7 @@ use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DB; use SilverStripe\ORM\FieldType\DBHTMLText; use SilverStripe\ORM\HiddenClass; +use SilverStripe\ORM\Hierarchy; use SilverStripe\ORM\Hierarchy\MarkedSet; use SilverStripe\ORM\SS_List; use SilverStripe\ORM\ValidationResult; @@ -462,8 +464,9 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr $childrenMethod = null, $numChildrenMethod = null, $filterFunction = null, - $nodeCountThreshold = 30 + $nodeCountThreshold = null ) { + $nodeCountThreshold = is_null($nodeCountThreshold) ? Config::inst()->get($className, 'node_threshold_total') : $nodeCountThreshold; // Provide better defaults from filter $filter = $this->getSearchFilter(); if ($filter) {