Merge pull request #2284 from wilr/closure_this_reference_fix

FIX: pass controller as reference inside closure.
This commit is contained in:
Ingo Schommer 2013-08-03 09:32:03 -07:00
commit 452dd16781

View File

@ -830,7 +830,7 @@ class LeftAndMain extends Controller implements PermissionProvider {
// match the filter criteria until they're queried (and matched up with previously marked nodes).
$nodeThresholdLeaf = Config::inst()->get('Hierarchy', 'node_threshold_leaf');
if($nodeThresholdLeaf && !$filterFunction) {
$nodeCountCallback = function($parent, $numChildren) use($controller, $className, $nodeThresholdLeaf) {
$nodeCountCallback = function($parent, $numChildren) use(&$controller, $className, $nodeThresholdLeaf) {
if($className == 'SiteTree' && $parent->ID && $numChildren > $nodeThresholdLeaf) {
return sprintf(
'<ul><li class="readonly"><span class="item">'