You are here

public static function Duration::preRenderElement in Duration Field 8

Prepares the element for rendering.

Parameters

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

Return value

array The $element with prepared values ready for rendering

File

src/Element/Duration.php, line 159

Class

Duration
Provides a duration form element.

Namespace

Drupal\duration_field\Element

Code

public static function preRenderElement(array $element) {

  // Set the wrapper as a container to the inner values.
  $element['#attributes']['type'] = 'container';
  Element::setAttributes($element, [
    'id',
    'name',
    'value',
  ]);
  static::setAttributes($element, [
    'form-duration',
  ]);
  return $element;
}