You are here

public function GenerateProducts::settingsFormValidate in Commerce Bulk 8

File

modules/commerce_generate/src/Plugin/DevelGenerate/GenerateProducts.php, line 363

Class

GenerateProducts
Provides a GenerateProducts plugin.

Namespace

Drupal\commerce_generate\Plugin\DevelGenerate

Code

public function settingsFormValidate(array $form, FormStateInterface $form_state) {
  if ($form_state
    ->getValue('kill') && !$form_state
    ->getValue('num')) {
    return;
  }
  if (!array_filter($form_state
    ->getValue('stores'))) {
    $form_state
      ->setErrorByName('stores', $this
      ->t('Please select at least one store!'));
  }
  if (!array_filter($form_state
    ->getValue('product_types'))) {
    $form_state
      ->setErrorByName('product_types', $this
      ->t('Please select at least one product type!'));
  }
}