mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: Re-declare $items to be an ArrayList if it's null
getBackLink() modified to tolerate empty ArrayList
This commit is contained in:
parent
824b5e0b67
commit
00ee8d8abf
@ -464,10 +464,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();
|
||||||
}
|
}
|
||||||
@ -786,7 +788,10 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
|
|||||||
/** @var ArrayList $items */
|
/** @var ArrayList $items */
|
||||||
$items = $this->popupController->Breadcrumbs($unlinked);
|
$items = $this->popupController->Breadcrumbs($unlinked);
|
||||||
|
|
||||||
if ($items) {
|
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([
|
||||||
@ -799,7 +804,6 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
|
|||||||
'Link' => false
|
'Link' => false
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$this->extend('updateBreadcrumbs', $items);
|
$this->extend('updateBreadcrumbs', $items);
|
||||||
return $items;
|
return $items;
|
||||||
|
Loading…
Reference in New Issue
Block a user