You are here

public function ContentDevelGenerate::settingsFormValidate in Devel 4.x

Same name and namespace in other branches
  1. 8.3 devel_generate/src/Plugin/DevelGenerate/ContentDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\ContentDevelGenerate::settingsFormValidate()
  2. 8 devel_generate/src/Plugin/DevelGenerate/ContentDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\ContentDevelGenerate::settingsFormValidate()
  3. 8.2 devel_generate/src/Plugin/DevelGenerate/ContentDevelGenerate.php \Drupal\devel_generate\Plugin\DevelGenerate\ContentDevelGenerate::settingsFormValidate()

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 DevelGenerateBase::settingsFormValidate

File

devel_generate/src/Plugin/DevelGenerate/ContentDevelGenerate.php, line 378

Class

ContentDevelGenerate
Provides a ContentDevelGenerate plugin.

Namespace

Drupal\devel_generate\Plugin\DevelGenerate

Code

public function settingsFormValidate(array $form, FormStateInterface $form_state) {
  if (!array_filter($form_state
    ->getValue('node_types'))) {
    $form_state
      ->setErrorByName('node_types', $this
      ->t('Please select at least one content type'));
  }
}