mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
ENHANCEMENT Allow Controllers to opt-out or modify the back link behaviour in GridFieldDetailForm
This commit is contained in:
parent
2212363a0f
commit
a2dbd69f2c
@ -231,7 +231,7 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler {
|
|||||||
$form = $this->ItemEditForm($this->gridField, $request);
|
$form = $this->ItemEditForm($this->gridField, $request);
|
||||||
|
|
||||||
$return = $this->customise(array(
|
$return = $this->customise(array(
|
||||||
'Backlink' => $controller->Link(),
|
'Backlink' => $controller->hasMethod('Backlink') ? $controller->Backlink() : $controller->Link(),
|
||||||
'ItemEditForm' => $form,
|
'ItemEditForm' => $form,
|
||||||
))->renderWith($this->template);
|
))->renderWith($this->template);
|
||||||
|
|
||||||
@ -308,7 +308,7 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler {
|
|||||||
// which requires more URL knowledge than the current link to this field gives us.
|
// which requires more URL knowledge than the current link to this field gives us.
|
||||||
// The current root record is held in session only,
|
// The current root record is held in session only,
|
||||||
// e.g. page/edit/show/6/ vs. page/edit/EditForm/field/MyGridField/....
|
// e.g. page/edit/show/6/ vs. page/edit/EditForm/field/MyGridField/....
|
||||||
$form->Backlink = $toplevelController->Link();
|
$form->Backlink = $toplevelController->hasMethod('Backlink') ? $toplevelController->Backlink() : $toplevelController->Link();
|
||||||
}
|
}
|
||||||
|
|
||||||
$cb = $this->component->getItemEditFormCallback();
|
$cb = $this->component->getItemEditFormCallback();
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
<a href="$Backlink"><% _t('Go back', 'Go back' ) %></a>
|
<% if Backlink %>
|
||||||
|
<a href="$Backlink"><% _t('Go back', 'Go back' ) %></a>
|
||||||
|
<% end_if %>
|
||||||
|
|
||||||
$ItemEditForm
|
$ItemEditForm
|
Loading…
x
Reference in New Issue
Block a user