You are here

public function ConvertBundlesForm::validateForm in Convert Bundles 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/ConvertBundlesForm.php, line 518

Class

ConvertBundlesForm
ConvertBundlesForm.

Namespace

Drupal\convert_bundles\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  switch ($this->step) {
    case 2:
      if (empty(array_filter($form_state
        ->getValues()['convert_bundles_from']))) {
        $form_state
          ->setErrorByName('convert_bundles_from', $this
          ->t('No bundles selected.'));
      }
      break;
    default:

      // TODO - validate other steps.
      break;
  }
}