You are here

public function BlockUploadPluploadForm::validateForm in Block Upload 8

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/BlockUploadPluploadForm.php, line 94

Class

BlockUploadPluploadForm
Block upload form.

Namespace

Drupal\block_upload\Form

Code

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