ENHANCEMENT Breadcrumbs support in GridFieldPopupForms (CMS only)

This commit is contained in:
Ingo Schommer 2012-02-28 18:48:33 +01:00
parent af9e46af74
commit 804e2daa71

View File

@ -291,4 +291,29 @@ class GridFieldPopupForm_ItemRequest extends RequestHandler {
function getTemplate() { function getTemplate() {
return $this->template; return $this->template;
} }
/**
* CMS-specific functionality: Passes through navigation breadcrumbs
* to the template, and includes the currently edited record (if any).
* see {@link LeftAndMain->Breadcrumbs()} for details.
*
* @param boolean $unlinked
* @return ArrayData
*/
function Breadcrumbs($unlinked = false) {
if(!($this->popupController instanceof LeftAndMain)) return false;
$items = $this->popupController->Breadcrumbs($unlinked);
if($this->record) {
$items->push(new ArrayData(array(
'Title' => $this->record->Title,
'Link' => false
)));
}
// TODO Remove once ViewableData->First()/Last() is fixed
foreach($items as $i => $item) $item->iteratorProperties($i, $items->Count());
return $items;
}
} }