template_preprocess_input

template_preprocess_input(&$variables)

Prepares variables for input templates.

Default template: input.html.twig.

Parameters

array $variables: An associative array containing:

  • element: An associative array containing the properties of the element. Properties used: #attributes.

File

core/includes/form.inc, line 333
Functions for form and batch generation and processing.

Code

function template_preprocess_input(&$variables) {
  $element = $variables['element'];
  // Remove name attribute if empty, for W3C compliance.
  if (isset($variables['attributes']['name']) && empty((string) $variables['attributes']['name'])) {
    unset($variables['attributes']['name']);
  }
  $variables['children'] = $element['#children'];
}
doc_Drupal
2016-10-29 09:46:43
Comments
Leave a Comment

Please login to continue.