mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merge pull request #4170 from kinglozzer/pulls/4137-leftandmain-tree
Store current page before marking tree nodes (fixes #4137, fixes silverstripe/silverstripe-cms#1135)
This commit is contained in:
commit
c877882f7e
@ -812,16 +812,19 @@ class LeftAndMain extends Controller implements PermissionProvider {
|
|||||||
$record = ($rootID) ? $this->getRecord($rootID) : null;
|
$record = ($rootID) ? $this->getRecord($rootID) : null;
|
||||||
$obj = $record ? $record : singleton($className);
|
$obj = $record ? $record : singleton($className);
|
||||||
|
|
||||||
|
// Get the current page
|
||||||
|
// NOTE: This *must* be fetched before markPartialTree() is called, as this
|
||||||
|
// causes the Hierarchy::$marked cache to be flushed (@see CMSMain::getRecord)
|
||||||
|
// which means that deleted pages stored in the marked tree would be removed
|
||||||
|
$currentPage = $this->currentPage();
|
||||||
|
|
||||||
// Mark the nodes of the tree to return
|
// Mark the nodes of the tree to return
|
||||||
if ($filterFunction) $obj->setMarkingFilterFunction($filterFunction);
|
if ($filterFunction) $obj->setMarkingFilterFunction($filterFunction);
|
||||||
|
|
||||||
$obj->markPartialTree($nodeCountThreshold, $this, $childrenMethod, $numChildrenMethod);
|
$obj->markPartialTree($nodeCountThreshold, $this, $childrenMethod, $numChildrenMethod);
|
||||||
|
|
||||||
// Ensure current page is exposed
|
// Ensure current page is exposed
|
||||||
// This call flushes the Hierarchy::$marked cache when the current node is deleted
|
if($currentPage) $obj->markToExpose($currentPage);
|
||||||
// @see CMSMain::getRecord()
|
|
||||||
// This will make it impossible to show children under a deleted parent page
|
|
||||||
// if($p = $this->currentPage()) $obj->markToExpose($p);
|
|
||||||
|
|
||||||
// NOTE: SiteTree/CMSMain coupling :-(
|
// NOTE: SiteTree/CMSMain coupling :-(
|
||||||
if(class_exists('SiteTree')) {
|
if(class_exists('SiteTree')) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user