MINOR Made GridFieldPopupForms work outside of the CMS again (was assuming existence of Breadcrumbs)

This commit is contained in:
Ingo Schommer 2012-03-08 19:53:19 +01:00
parent 08c3e7edf3
commit ae17e97d75

View File

@ -236,7 +236,7 @@ class GridFieldPopupForm_ItemRequest extends RequestHandler {
// Add a Cancel link which is a button-like link and link back to one level up.
$curmbs = $this->Breadcrumbs();
if($curmbs->count()>=2){
if($curmbs && $curmbs->count()>=2){
$one_level_up = $curmbs->offsetGet($curmbs->count()-2);
$text = "
<a class=\"crumb ss-ui-button ss-ui-action-destructive cms-panel-link ui-corner-all\" href=\"".$one_level_up->Link."\">
@ -378,6 +378,8 @@ class GridFieldPopupForm_ItemRequest extends RequestHandler {
* @return ArrayData
*/
function Breadcrumbs($unlinked = false) {
if(!$this->popupController->hasMethod('Breadcrumbs')) return;
$items = $this->popupController->Breadcrumbs($unlinked);
if($this->record && $this->record->ID) {
$items->push(new ArrayData(array(