Merge branch '3.2' into 3.3

This commit is contained in:
Daniel Hensby 2016-07-14 11:56:35 +01:00
commit a2581b9cf7
No known key found for this signature in database
GPG Key ID: B00D1E9767F0B06E

View File

@ -549,18 +549,18 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler {
$list->add($this->record, $extraData); $list->add($this->record, $extraData);
} catch(ValidationException $e) { } catch(ValidationException $e) {
$form->sessionMessage($e->getResult()->message(), 'bad', false); $form->sessionMessage($e->getResult()->message(), 'bad', false);
$responseNegotiator = new PjaxResponseNegotiator(array( if ($controller->getRequest()->isAjax()) {
'CurrentForm' => function() use(&$form) { $responseNegotiator = new PjaxResponseNegotiator(array(
return $form->forTemplate(); 'CurrentForm' => function () use (&$form) {
}, return $form->forTemplate();
'default' => function() use(&$controller) { },
return $controller->redirectBack(); ));
}
));
if($controller->getRequest()->isAjax()){
$controller->getRequest()->addHeader('X-Pjax', 'CurrentForm'); $controller->getRequest()->addHeader('X-Pjax', 'CurrentForm');
return $responseNegotiator->respond($controller->getRequest());
} }
return $responseNegotiator->respond($controller->getRequest()); Session::set("FormInfo.{$form->FormName()}.errors", array());
Session::set("FormInfo.{$form->FormName()}.data", $form->getData());
return $controller->redirectBack();
} }
// TODO Save this item into the given relationship // TODO Save this item into the given relationship