You are here

public static function CardNumber::preRenderCardNumber in Creditfield Form Element 8

Prepares a #type 'creditfield_cardnumber' render element for input.html.twig.

Parameters

array $element: An associative array containing the properties of the element. Properties used: #title, #value, #description, #size, #maxlength, #placeholder, #required, #attributes.

Return value

array The $element with prepared variables ready for input.html.twig.

File

src/Element/CardNumber.php, line 80

Class

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

Namespace

Drupal\creditfield\Element

Code

public static function preRenderCardNumber($element) {
  $element['#attributes']['type'] = 'text';
  Element::setAttributes($element, [
    'id',
    'name',
    'value',
    'size',
    'maxlength',
    'placeholder',
  ]);
  static::setAttributes($element, [
    'form-text',
  ]);
  return $element;
}