You are here

public function CurrencyForm::validateRoundingStep in Currency 8.3

Implements #element_validate for the rounding step element.

File

src/Entity/Currency/CurrencyForm.php, line 212

Class

CurrencyForm
Provides a currency add/edit form.

Namespace

Drupal\currency\Entity\Currency

Code

public function validateRoundingStep(array $element, FormStateInterface $form_state, array $form) {
  $rounding_step = $this->inputParser
    ->parseAmount($element['#value']);
  if ($rounding_step === FALSE) {
    $form_state
      ->setError($element, $this
      ->t('The rounding step is not numeric.'));
  }
  $form_state
    ->setValueForElement($element, $rounding_step);
}