mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR Moving CMS-specific customisations to GridFieldPopupForms into form getter, so it also applies when the form has validation errors
This commit is contained in:
parent
9a02f19b66
commit
8a4a6efe29
@ -152,7 +152,7 @@ class GridFieldPopupForm_ItemRequest extends RequestHandler {
|
||||
*/
|
||||
public function __construct($gridField, $component, $record, $popupController, $popupFormName) {
|
||||
$this->gridField = $gridField;
|
||||
$this->component = $gridField;
|
||||
$this->component = $component;
|
||||
$this->record = $record;
|
||||
$this->popupController = $popupController;
|
||||
$this->popupFormName = $popupFormName;
|
||||
@ -167,19 +167,6 @@ class GridFieldPopupForm_ItemRequest extends RequestHandler {
|
||||
$controller = $this->popupController;
|
||||
$form = $this->ItemEditForm($this->gridField, $request);
|
||||
|
||||
// TODO Coupling with CMS
|
||||
if($controller instanceof LeftAndMain) {
|
||||
$form->addExtraClass('cms-edit-form');
|
||||
$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(
|
||||
'Backlink' => $controller->Link(),
|
||||
'ItemEditForm' => $form,
|
||||
@ -221,6 +208,20 @@ class GridFieldPopupForm_ItemRequest extends RequestHandler {
|
||||
)
|
||||
);
|
||||
$form->loadDataFrom($this->record);
|
||||
|
||||
// TODO Coupling with CMS
|
||||
if($this->popupController instanceof LeftAndMain) {
|
||||
$form->addExtraClass('cms-edit-form');
|
||||
$form->setTemplate($this->popupController->getTemplatesWithSuffix('_EditForm'));
|
||||
$form->addExtraClass('cms-content center ss-tabset ' . $this->popupController->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 = $this->popupController->Link();
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user