Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

FIX 7617: Back button in CMS after Add/Edit/View action in GridField …

…does not work
  • Loading branch information...
commit 78038eb75e1e41feb50dc2649a37d63c3531af4d 1 parent 155758f
@jakr jakr authored chillu committed
Showing with 9 additions and 5 deletions.
  1. +9 −5 forms/gridfield/GridFieldDetailForm.php
View
14 forms/gridfield/GridFieldDetailForm.php
@@ -328,11 +328,15 @@ function ItemEditForm() {
$form->addExtraClass('cms-content cms-edit-form center ss-tabset');
$form->setAttribute('data-pjax-fragment', 'CurrentForm Content');
if($form->Fields()->hasTabset()) $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
- // TODO Link back to controller action (and edited root record) rather than index,
- // which requires more URL knowledge than the current link to this field gives us.
- // The current root record is held in session only,
- // e.g. page/edit/show/6/ vs. page/edit/EditForm/field/MyGridField/....
- $form->Backlink = $toplevelController->hasMethod('Backlink') ? $toplevelController->Backlink() : $toplevelController->Link();
+
+ if($toplevelController->hasMethod('Backlink')) {
+ $form->Backlink = $toplevelController->Backlink();
+ } elseif($this->popupController->hasMethod('Breadcrumbs')) {
+ $parents = $this->popupController->Breadcrumbs(false)->items;
+ $form->Backlink = array_pop($parents)->Link;
+ } else {
+ $form->Backlink = $toplevelController->Link();
+ }
}
$cb = $this->component->getItemEditFormCallback();

1 comment on commit 78038eb

@mattclegg

Im so glad this has been fixed

Please sign in to comment.
Something went wrong with that request. Please try again.