Merge pull request #9748 from tom890180/4.6

Merge the "Merge pull request #9565 from tom890180/check_items_exist" to 4.6
This commit is contained in:
Steve Boyd 2021-03-23 11:01:30 +13:00 committed by GitHub
commit 169c06131a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -452,10 +452,12 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
if ($toplevelController->hasMethod('Backlink')) { if ($toplevelController->hasMethod('Backlink')) {
$backlink = $toplevelController->Backlink(); $backlink = $toplevelController->Backlink();
} elseif ($this->popupController->hasMethod('Breadcrumbs')) { } elseif ($this->popupController->hasMethod('Breadcrumbs')) {
$parents = $this->popupController->Breadcrumbs(false)->items; $parents = $this->popupController->Breadcrumbs(false);
if ($parents && $parents = $parents->items) {
$backlink = array_pop($parents)->Link; $backlink = array_pop($parents)->Link;
} }
} }
}
if (!$backlink) { if (!$backlink) {
$backlink = $toplevelController->Link(); $backlink = $toplevelController->Link();
} }
@ -774,6 +776,10 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
/** @var ArrayList $items */ /** @var ArrayList $items */
$items = $this->popupController->Breadcrumbs($unlinked); $items = $this->popupController->Breadcrumbs($unlinked);
if (!$items) {
$items = new ArrayList();
}
if ($this->record && $this->record->ID) { if ($this->record && $this->record->ID) {
$title = ($this->record->Title) ? $this->record->Title : "#{$this->record->ID}"; $title = ($this->record->Title) ? $this->record->Title : "#{$this->record->ID}";
$items->push(new ArrayData([ $items->push(new ArrayData([