template_preprocess_textarea

template_preprocess_textarea(&$variables)

Prepares variables for textarea templates.

Default template: textarea.html.twig.

Parameters

array $variables: An associative array containing:

  • element: An associative array containing the properties of the element. Properties used: #title, #value, #description, #rows, #cols, #placeholder, #required, #attributes, #resizable

File

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

Code

function template_preprocess_textarea(&$variables) {
  $element = $variables['element'];
  Element::setAttributes($element, array('id', 'name', 'rows', 'cols', 'placeholder'));
  RenderElement::setAttributes($element, array('form-textarea'));
  $variables['wrapper_attributes'] = new Attribute();
  $variables['attributes'] = new Attribute($element['#attributes']);
  $variables['value'] = $element['#value'];
  $variables['resizable'] = !empty($element['#resizable']) ? $element['#resizable'] : NULL;
  $variables['required'] = !empty($element['#required']) ? $element['#required'] : NULL;
}
doc_Drupal
2016-10-29 09:46:49
Comments
Leave a Comment

Please login to continue.