Permalink
Browse files

MINOR Backlinks in CMS edit form template, first defined in GridField…

…PopupForms
  • Loading branch information...
chillu committed Feb 27, 2012
1 parent 8ff8d32 commit f1775b5f8459ea6fd415aa782a5e5bb80073d0a7
@@ -1,4 +0,0 @@
-<div class="cms-content-fields center">
- <a class="backlink ss-ui-button" href="$Backlink">Back</a>
- $ItemEditForm
-</div>
@@ -20,6 +20,13 @@
<% end_if %>
<!-- <div class="cms-content-search">...</div> -->
+
+ <% if Backlink %>
+ <a class="backlink ss-ui-button" href="$Backlink">
+ <% _t('Back', 'Back') %>
+ </a>
+ <% end_if %>
+
</div>
</div>
@@ -173,6 +173,11 @@ function edit($request) {
$form->setTemplate($controller->getTemplatesWithSuffix('_EditForm'));
$form->addExtraClass('cms-content center ss-tabset ' . $controller->BaseCSSClasses());
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 = $controller->Link();
}
$return = $this->customise(array(

0 comments on commit f1775b5

Please sign in to comment.