You are here

public static function QuantityWidget::validateSettingsForm in Commerce Core 8.2

Validates the settings form.

Parameters

array $element: The settings form element.

\Drupal\Core\Form\FormStateInterface $form_state: The form state.

File

modules/order/src/Plugin/Field/FieldWidget/QuantityWidget.php, line 76

Class

QuantityWidget
Plugin implementation of the 'commerce_quantity' widget.

Namespace

Drupal\commerce_order\Plugin\Field\FieldWidget

Code

public static function validateSettingsForm(array $element, FormStateInterface $form_state) {
  $value = $form_state
    ->getValue($element['#parents']);
  if (empty($value['allow_decimal'])) {
    $value['step'] = '1';
  }
  unset($value['allow_decimal']);
  $form_state
    ->setValue($element['#parents'], $value);
}