You are here

public static function FractionDecimal::preRenderNumber in Fraction 8

Same name and namespace in other branches
  1. 2.x src/Element/FractionDecimal.php \Drupal\fraction\Element\FractionDecimal::preRenderNumber()

Prepares a #type 'fraction_decimal' 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/FractionDecimal.php, line 129

Class

FractionDecimal
Provides a fraction decimal form element.

Namespace

Drupal\fraction\Element

Code

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