[CORE][Form] Remove unweildy return of form errors from Form::handle
This commit is contained in:
parent
8433771465
commit
5c708af272
|
@ -163,15 +163,7 @@ abstract class Form
|
||||||
|
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
if ($request->getMethod() === 'POST' && $form->isSubmitted()) {
|
if ($request->getMethod() === 'POST' && $form->isSubmitted()) {
|
||||||
if (!$form->isValid()) {
|
if ($form->isValid()) {
|
||||||
$errors = [];
|
|
||||||
foreach ($form->all() as $child) {
|
|
||||||
if (!$child->isValid()) {
|
|
||||||
$errors[$child->getName()] = (string) $form[$child->getName()]->getErrors();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $errors;
|
|
||||||
} else {
|
|
||||||
$data = $form->getData();
|
$data = $form->getData();
|
||||||
if (\is_null($target)) {
|
if (\is_null($target)) {
|
||||||
return $data;
|
return $data;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user