Skip to content

Commit

Permalink
MINOR Backlinks in CMS edit form template, first defined in GridField…
Browse files Browse the repository at this point in the history
…PopupForms
  • Loading branch information
chillu committed Feb 27, 2012
1 parent 8ff8d32 commit f1775b5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 0 additions & 4 deletions admin/templates/CMSGridFieldPopupForms.ss

This file was deleted.

7 changes: 7 additions & 0 deletions admin/templates/Includes/LeftAndMain_EditForm.ss
Expand Up @@ -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>

Expand Down
5 changes: 5 additions & 0 deletions forms/gridfield/GridFieldPopupForms.php
Expand Up @@ -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(
Expand Down

0 comments on commit f1775b5

Please sign in to comment.