You are here

public function SourceSelectForm::validateForm in WordPress Migrate 8.3

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

wordpress_migrate_ui/src/Form/SourceSelectForm.php, line 57

Class

SourceSelectForm
Simple wizard step form.

Namespace

Drupal\wordpress_migrate_ui\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  $all_files = $this
    ->getRequest()->files
    ->get('files', []);
  if (empty($all_files['wxr_file'])) {
    $form_state
      ->setErrorByName('wxr_file', $this
      ->t('You must upload a file to continue.'));
  }
}