You are here

public function PercentageOffTrait::validateConfigurationForm in Commerce Core 8.2

File

modules/promotion/src/Plugin/Commerce/PromotionOffer/PercentageOffTrait.php, line 60

Class

PercentageOffTrait
Provides common configuration for percentage off offers.

Namespace

Drupal\commerce_promotion\Plugin\Commerce\PromotionOffer

Code

public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
  $values = $form_state
    ->getValue($form['#parents']);
  if (empty($values['percentage'])) {
    $form_state
      ->setError($form, $this
      ->t('Percentage must be a positive number.'));
  }
}