[CORE][Form] Remove unweildy return of form errors from Form::handle

This commit is contained in:
Hugo Sales 2022-03-13 14:19:56 +00:00
parent 8433771465
commit 5c708af272
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
1 changed files with 1 additions and 9 deletions

View File

@ -163,15 +163,7 @@ abstract class Form
$form->handleRequest($request);
if ($request->getMethod() === 'POST' && $form->isSubmitted()) {
if (!$form->isValid()) {
$errors = [];
foreach ($form->all() as $child) {
if (!$child->isValid()) {
$errors[$child->getName()] = (string) $form[$child->getName()]->getErrors();
}
}
return $errors;
} else {
if ($form->isValid()) {
$data = $form->getData();
if (\is_null($target)) {
return $data;