This does the actual job. Method travels through all levels of form recursively and gathers errors.

@param   FormInterface $form
@param   array         &$results

@return  array
172746
private function realParseErrors(FormInterface $form, array &$results)
	{
		$errors = $form->getErrors();

		if (count($errors) > 0)
		{
			$config      = $form->getConfig();
			$name        = $form->getName();
			$label       = $config->getOption('label');
			$translation = $this->getTranslationDomain($form);
			if (empty($label))
			{
				$label = ucfirst(trim(strtolower(preg_replace(array('/([A-Z])/', '/[_\s]+/'), array('_$1', ' '), $name))));
			}

			$results[] = array(
				'name'        => $name,
				'label'       => $label,
				'errors'      => $errors,
				'translation' => $translation,
			);
		}

		$children = $form->all();
		if (count($children) > 0)
		{
			foreach ($children as $child)
			{
				if ($child instanceof FormInterface)
				{
					$this->realParseErrors($child, $results);
				}
			}
		}

		return $results;
	}
638377
function($form) {
        var $form = $form, _id = null;
        if ( typeof($form) == 'undefined' ) {
            if ( typeof(this.target) != 'undefined' ) {
                _id = this.target.getAttribute('id');
            } else {
                _id = this.getAttribute('id');
            }

            $form = instance.$forms[_id]
        } else if ( typeof($form) == 'string' ) {
            _id = $form;
            _id = _id.replace(/\#/, '');

            if ( typeof(instance.$forms[_id]) == 'undefined') {
                throw new Error('[ FormValidator::resetErrorsDisplay([formId]) ] `'+$form+'` not found')
            }

            $form = instance.$forms[_id]
        }
        //reseting error display
        handleErrorsDisplay($form['target'], []);

        return $form
    }
236280
public function render(FormInterface $form, $renderMode = null)
    {
        if (method_exists($form, 'prepare')) {
            $form->prepare();
        }

        $fieldsetHelper = $this->getFieldsetHelper();
        if (method_exists($fieldsetHelper, 'setForm')) {
            $fieldsetHelper->setForm($form);
        }

        if (null === $renderMode) {
            $renderMode = $form->getOption('render_mode');
        }

        $rollbackRenderMode = null;
        if ($renderMode && $fieldsetHelper instanceof FormCollection) {
            $elementHelper = $this->view->plugin($fieldsetHelper->getDefaultElementHelper());
            if ($elementHelper instanceof FormRow) {
                $rollbackRenderMode = $elementHelper->getRenderMode();
                if ($rollbackRenderMode !== $renderMode) {
                    $elementHelper->setRenderMode($renderMode);
                }
            }
        }

        $formMessagesHelper = $this->getFormMessagesHelper();

        $markup = $this->openTag($form)
            . $formMessagesHelper($form)
            . $fieldsetHelper($form, false, false)
            . $this->closeTag();

        if ($rollbackRenderMode) {
            $elementHelper->setRenderMode($rollbackRenderMode);
        }

        return $markup;
    }
1066348
protected function getValidationGroups(Form $form)
    {
        $result = array('Default');
        $groups = $form->getConfig()->getOption('validation_groups');

        if (empty($groups)) {
            // Try to get groups from a parent
            if ($form->getParent()) {
                $result = $this->getValidationGroups($form->getParent());
            }
        } elseif (is_array($groups)) {
            // If groups is an array - return groups as is
            $result = $groups;
        } elseif ($groups instanceof \Closure) {
            // If groups is a Closure - return the form class name to look for javascript
            $result = $this->getElementId($form);
        }

        return $result;
    }
1048407
public function getErrorMessages(FormInterface $form, bool $useLabels = false, array $errors = []):array
    {
        if ($form->count() > 0) {
            foreach ($form->all() as $child) {
                if (!$child->isValid()) {
                    $errors = $this->getErrorMessages($child, $useLabels, $errors);
                }
            }
        }

        foreach ($form->getErrors() as $error) {
            if ($useLabels) {
                $fieldNameData = $this->getErrorFormLabel($form);
            } else {
                $fieldNameData = $this->getErrorFormId($form);
            }

            $fieldName = $fieldNameData;

            if ($useLabels) {
                /**
                 * @ignore
                 */
                $fieldName = $this->translator->trans($fieldNameData['label'], array(), $fieldNameData['domain']);
            }

            $errors[$fieldName] = $error->getMessage();
        }

        return $errors;
    }
470870
protected function updateErrorBox(Form $form, $errors)
    {
        foreach ($form->getChildrenByType('\\Zepi\\Web\\UserInterface\\Form\\ErrorBox', true) as $errorBox) {
            $errorBox->updateErrorBox($form, false, $errors);
        }
    }
1189091
protected function prepareFilterValues(FormInterface $form)
    {
        $config = $form->getConfig();
        $values = $this->dataExtractor->extractData($form, $config->getOption('data_extraction_method', 'default'));

        if ($config->hasAttribute('filter_options')) {
            $values = array_merge($values, $config->getAttribute('filter_options'));
        }

        return $values;
    }
491358
public function getAttributesForForm(Form $form)
    {
        // Obtain Attributes (from parent):
        
        $attributes = parent::getAttributesForForm($form);
        
        // Define Group Class:
        
        $attributes['data-group-class'] = $this->config()->group_class;
        
        // Define Error Wrapper Class:
        
        $attributes['data-error-wrapper-class'] = $this->config()->error_wrapper_class;
        
        // Define Error Classes:
        
        $attributes['data-group-error-class']   = $this->config()->group_error_class;
        $attributes['data-field-error-class']   = $this->config()->field_error_class;
        
        // Define Success Classes:
        
        $attributes['data-group-success-class'] = $this->config()->group_success_class;
        $attributes['data-field-success-class'] = $this->config()->field_success_class;
        
        // Define Trigger Events:
        
        $attributes['data-parsley-trigger'] = $this->getTriggerOn();
        
        // Answer Attributes:
        
        return $this->flatten($attributes);
    }
705423
public function getState(Form $form)
    {
        $state = [
            'id' => $form->FormName(),
            'fields' => [],
            'messages' => [],
            'notifyUnsavedChanges' => $form->getNotifyUnsavedChanges(),
        ];

        // flattened nested fields are returned, rather than only top level fields.
        $state['fields'] = array_merge(
            $this->getFieldStates($form->Fields()),
            $this->getFieldStates($form->Actions())
        );

        if ($message = $form->getSchemaMessage()) {
            $state['messages'][] = $message;
        }

        return $state;
    }
255341
public function saveStep(FormInterface $form)
    {
        $answers = $this->getUserConfiguration()->getAnswers();
        $data = $form->getData();
        $answersData = $form->get('answers')->getData();

        if (is_null($answersData)) {
            $answersData = array();
        } else if (!is_array($answersData)) {
            $answersData = array($answersData);
        }

        $answers[$this->getCurrentQuestion()] = array_merge($answersData, $data);
        $this->getUserConfiguration()->setAnswers($answers);
        $this->updateSessionConfiguration();

        return $this;
    }
89700
public function rebuildAjaxCallback(array &$form, FormStateInterface $form_state) {
    $parameters = $form_state->getUserInput();
    // Remove empty/NULL display.
    if (empty($parameters['display'])) {
      unset($parameters['display']);
    }
    else {
      unset($parameters['time']);
    }
    $formatted_results = $this->buildResults($form, $parameters);
    $filters = self::buildFilters($parameters);
    $alerts = self::buildAlerts($parameters);
    $branch_hours = $this->buildBranchHours($form, $parameters);
    $response = new AjaxResponse();
    $response->addCommand(new HtmlCommand('#schedules-search-form-wrapper .selects-container', $form['selects']));
    $response->addCommand(new HtmlCommand('#schedules-search-listing-wrapper .results', $formatted_results));
    $response->addCommand(new HtmlCommand('#schedules-search-form-wrapper .filters-container', $filters));
    $response->addCommand(new HtmlCommand('#schedules-search-listing-wrapper .alerts-wrapper', $alerts));
    $response->addCommand(new HtmlCommand('#schedules-search-listing-wrapper .branch-hours-wrapper', $branch_hours));
    $response->addCommand(new InvokeCommand(NULL, 'schedulesAjaxAction', [$parameters]));
    $form_state->setRebuild();
    return $response;
  }
181009
protected function processFields(array $fields, array $results = [])
    {
        $input = $this->input;
        $output = $this->output;
        $helper = $this->helperSet->get('question');

        foreach ($fields as $field) {
            if (!$field instanceof FieldDefinitionInterface) {
                continue;
            }
            $field_name = $field->getName();

            if (isset($results[$field_name])) {
                continue;
            }

            if (!$field instanceof FieldGroup) {
                if ($field->hasCondition()
                    && !$this->fieldConditionMet($field, $results)) {
                    continue;
                }

                if ($field->hasFieldCallback()) {
                    $field->onFieldCallback($results);
                }

                if ($input->isInteractive()) {
                    try {
                        $value = $helper->ask($input, $output, $field->asQuestion());

                        if ($field->hasSubform()) {
                            $subform = new static();
                            $field->onSubformProcess($subform, $value);

                            $results[$field_name] = $subform
                                ->setInput($input)
                                ->setOutput($output)
                                ->setHelperSet($this->helperSet)
                                ->process()
                                ->getResults();
                        } else {
                            $results[$field_name] = $field->formattedValue($value);
                        }
                    } catch (\Exception $e) {
                        throw new FormException(trim($e->getMessage()));
                    }
                }
            } else {
                $groups = [];

                do {
                    $result = $this->processFields(
                        $field->getGroupFields()
                    );
                    $continue = false;

                    if ($field->hasLoopUntil()) {
                        $continue = $field->loopUntil([$result]);
                        if ($continue) {
                            $groups[] = $result;
                        }
                    } else {
                        $groups[] = $result;
                    }
                } while ($continue);

                $results[$field_name] = $groups;
            }
        }

        return $results;
    }
396935
public function createFormErrorArray(Form $data)
    {
        $form = [];
        $errors = [];
        foreach ($data->getErrors() as $error) {
            $errors[] = $this->getErrorMessage($error);
        }

        if ($errors) {
            $form['errors'] = $errors;
        }

        $children = [];
        foreach ($data->all() as $child) {
            if ($child instanceof Form) {
                $children[$child->getName()] = $this->createFormErrorArray($child);
            }
        }

        if ($children) {
            $form['children'] = $children;
        }

        return $form;
    }
440535
private function createFormView(FormInterface $form)
    {
        $themes = $this->getParameterResolver()->resolveThemes();
        $view = $form->createView();

        if (!empty($themes)) {
            $this->formRenderer->setTheme($view, $themes);
        }

        return $view;
    }
1340690
public function process(Request $request, FormInterface $form)
    {
        if ($request->isMethod('POST')) {
            $form->submit($request);
            if ($form->isValid()) {
                return true;
            }
        }

        return false;
    }
485158
protected function processChildren($form)
    {
        $result = array();
        // If this field has children - process them
        foreach ($form as $name => $child) {
            if ($this->isProcessableElement($child)) {
                $childModel = $this->createJsModel($child);
                if (null !== $childModel) {
                    $result[$name] = $childModel;
                }
            }
        }

        return $result;
    }
602629
public function getSubmittedName(FormInterface $form)
    {
        foreach ($form as $field) {
            if ($field instanceof ClickableInterface && $field->isClicked()) {
                return $field->getName();
            }
        }

        return null;
    }