Fix for v4: Admin returns "Too many pages" for subpages below top level (#6464)

* Fix for v4: Admin returns "Too many pages" for subpages below top level

Simple logic error during porting to new version it appears

* V4: LeftAndMain::getSiteTreeFor() returning space & New line in link

The "Too many pages" "View as list" link had a return &
  tab characters in it

* V4: LeftAndMain::getSiteTreeFor() fixes link for list view

"Too many pages" link pointed to `?view=list` which is
  just normal hierarchy. Value had been updated to "listview"
  in #8c87ea6b
This commit is contained in:
Lee Bradley 2017-01-09 12:45:03 +00:00 committed by Daniel Hensby
parent c2bc0df92a
commit 87fbd5f781

View File

@ -1188,7 +1188,7 @@ class LeftAndMain extends Controller implements PermissionProvider
$nodeCountCallback = function ($parent, $numChildren) use (&$controller, $className, $nodeThresholdLeaf) { $nodeCountCallback = function ($parent, $numChildren) use (&$controller, $className, $nodeThresholdLeaf) {
if ($className !== 'SilverStripe\\CMS\\Model\\SiteTree' if ($className !== 'SilverStripe\\CMS\\Model\\SiteTree'
|| !$parent->ID || !$parent->ID
|| $numChildren >= $nodeThresholdLeaf || $numChildren <= $nodeThresholdLeaf
) { ) {
return null; return null;
} }
@ -1199,8 +1199,7 @@ class LeftAndMain extends Controller implements PermissionProvider
_t('LeftAndMain.TooManyPages', 'Too many pages'), _t('LeftAndMain.TooManyPages', 'Too many pages'),
Controller::join_links( Controller::join_links(
$controller->LinkWithSearch($controller->Link()), $controller->LinkWithSearch($controller->Link()),
' '?view=listview&ParentID=' . $parent->ID
?view=list&ParentID=' . $parent->ID
), ),
_t( _t(
'LeftAndMain.ShowAsList', 'LeftAndMain.ShowAsList',