You are here

public function ExportForm::validateForm in Default Content Deploy 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/ExportForm.php, line 232

Class

ExportForm
Config Form for run DCD deploy in Admin UI.

Namespace

Drupal\default_content_deploy\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  parent::validateForm($form, $form_state);
  $mode = $form_state
    ->getValue('mode');
  $entity_type = $form_state
    ->getValue('entity_type');
  if ($mode != 'all' && $entity_type == NULL) {
    $form_state
      ->setErrorByName('entity_type', $this
      ->t('@name field is required.', [
      '@name' => $form['settings']['entity_type']['#title'],
    ]));
  }
}