ENH Keep state in Page's Breadcrumbs

This commit is contained in:
Sabina Talipova 2022-07-25 14:44:23 +12:00
parent a2907dc851
commit c09b4e756f
1 changed files with 7 additions and 2 deletions

View File

@ -1084,14 +1084,19 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
$ancestors = $record->getAncestors();
$ancestors = new ArrayList(array_reverse($ancestors->toArray() ?? []));
$ancestors->push($record);
$params = $this->getRequest()->getVars();
/** @var SiteTree $ancestor */
foreach ($ancestors as $ancestor) {
$items->push(new ArrayData([
'Title' => $ancestor->getMenuTitle(),
'Link' => ($unlinked)
? false
: $ancestor->CMSEditLink()
]));
: Controller::join_links(
$ancestor->CMSEditLink(),
'?' . http_build_query($params ?? [])
)
]));
}
$this->extend('updateBreadcrumbs', $items);