You are here

public function PluploadTestForm::validateForm in Plupload integration 8

Same name and namespace in other branches
  1. 2.0.x plupload_test/src/PluploadTestForm.php \Drupal\plupload_test\PluploadTestForm::validateForm()

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 FormInterface::validateForm

File

plupload_test/src/PluploadTestForm.php, line 45

Class

PluploadTestForm
Plupload test form class.

Namespace

Drupal\plupload_test

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  foreach ($form_state
    ->getValue('plupload') as $uploaded_file) {
    if ($uploaded_file['status'] != 'done') {
      $form_state
        ->setErrorByName('plupload', $this
        ->t("Upload of %filename failed.", [
        '%filename' => $uploaded_file['name'],
      ]));
    }
  }
}