You are here

public static function TimeElement::preRenderTime in Field Time 1.0.x

Prepares a #type 'time' 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.

See also

\Drupal\time_field\Plugin\Field\FieldWidget\TimeWidget::formElement()

File

src/Element/TimeElement.php, line 73

Class

TimeElement
Provides a time field form element.

Namespace

Drupal\field_time\Element

Code

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