You are here

public static function YamlFormSubmissionForm::hiddenElementAfterBuild in YAML Form 8

Form element #after_build callback: Wrap #element_validate so that we suppress element validation errors.

File

src/YamlFormSubmissionForm.php, line 1179

Class

YamlFormSubmissionForm
Provides a form to collect and edit submissions.

Namespace

Drupal\yamlform

Code

public static function hiddenElementAfterBuild(array $element, FormStateInterface $form_state) {
  if (!empty($element['#element_validate'])) {
    $element['#_element_validate'] = $element['#element_validate'];
    $element['#element_validate'] = [
      [
        get_called_class(),
        'hiddenElementValidate',
      ],
    ];
  }
  return $element;
}