function BlockContentDevelGenerate::settingsFormValidate

Overrides DevelGenerateBase::settingsFormValidate

File

devel_generate/src/Plugin/DevelGenerate/BlockContentDevelGenerate.php, line 172

Class

BlockContentDevelGenerate
Provides a BlockContentDevelGenerate plugin.

Namespace

Drupal\devel_generate\Plugin\DevelGenerate

Code

public function settingsFormValidate(array $form, FormStateInterface $form_state) : void {
    if (array_filter($form_state->getValue('block_types')) === []) {
        $form_state->setErrorByName('block_types', $this->t('Please select at least one block type'));
    }
    $skip_fields = is_null($form_state->getValue('skip_fields')) ? [] : self::csvToArray($form_state->getValue('skip_fields'));
    $base_fields = is_null($form_state->getValue('base_fields')) ? [] : self::csvToArray($form_state->getValue('base_fields'));
    $form_state->setValue('skip_fields', $skip_fields);
    $form_state->setValue('base_fields', $base_fields);
}