You are here

public static function CardExpiration::validateCardExpiration in Creditfield Form Element 8

File

src/Element/CardExpiration.php, line 48

Class

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

Namespace

Drupal\creditfield\Element

Code

public static function validateCardExpiration(&$element, FormStateInterface $form_state, &$complete_form) {
  if (!static::dateIsValid($element['#value'])) {
    $form_state
      ->setError($element, t('Please enter a valid expiration date.'));
  }
}