You are here

public function FileAddForm::validateForm in File Entity (fieldable files) 8.2

Form validation handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormBase::validateForm

File

src/Form/FileAddForm.php, line 320

Class

FileAddForm
Form controller for file type forms.

Namespace

Drupal\file_entity\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  if ($form_state
    ->get('step') == 4) {

    /** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display */
    $form_display = $form_state
      ->get('form_display');
    $form_display
      ->extractFormValues($form_state
      ->get('file'), $form, $form_state);
    $form_display
      ->validateFormValues($form_state
      ->get('file'), $form, $form_state);
  }
  parent::validateForm($form, $form_state);
}