You are here

public static function CardCode::validateCardCode in Creditfield Form Element 8

File

src/Element/CardCode.php, line 50

Class

CardCode
Provides a one-line credit card number field form element.

Namespace

Drupal\creditfield\Element

Code

public static function validateCardCode(&$element, FormStateInterface $form_state, &$complete_form) {
  if (!static::numberIsValid($element['#value'])) {
    $form_state
      ->setError($element, t('Please enter a valid card code.'));
    return;
  }
}