You are here

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

Prepares a #type 'creditfield_code' 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/CardCode.php, line 79

Class

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

Namespace

Drupal\creditfield\Element

Code

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