diff --git a/core/includes/form.inc b/core/includes/form.inc index 87f8edf..502aec9 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -2575,22 +2575,23 @@ function theme_form($variables) { } /** - * Returns HTML for a textarea form element. + * Prepares variables for textarea templates. * - * @param $variables + * Default template: textarea.html.twig. + * + * @param 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 * - * @ingroup themeable */ -function theme_textarea($variables) { +function template_preprocess_textarea(&$variables) { $element = $variables['element']; element_set_attributes($element, array('id', 'name', 'rows', 'cols', 'placeholder')); - _form_set_attributes($element, array('form-textarea')); + $variables['attributes'] = $element['#attributes']; - $wrapper_attributes = array( + $variables['wrapper_attributes'] = array( 'class' => array('form-textarea-wrapper'), ); @@ -2599,10 +2600,11 @@ function theme_textarea($variables) { $element['#attributes']['class'][] = 'resize-' . $element['#resizable']; } - $output = ''; - $output .= '' . String::checkPlain($element['#value']) . ''; - $output .= ''; - return $output; + $variables['attributes']['class'] = array(); + $variables['attributes']['class'][] = 'form-textarea'; + $variables['attributes']['class'] = array_merge($variables['attributes']['class'], $element['#attributes']['class']); + + $variables['value'] = String::checkPlain($element['#value']); } /** diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 37f04f9..43111fb 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -2701,6 +2701,7 @@ function drupal_common_theme() { ), 'textarea' => array( 'render element' => 'element', + 'template' => 'textarea', ), 'tableselect' => array( 'render element' => 'element', diff --git a/core/modules/system/templates/textarea.html.twig b/core/modules/system/templates/textarea.html.twig new file mode 100644 index 0000000..4955f7c --- /dev/null +++ b/core/modules/system/templates/textarea.html.twig @@ -0,0 +1,18 @@ +{# +/** + * @file + * Default theme implementation for a 'textarea' #type form element. + * + * Available variables + * - wrapper_attributes: A list of HTML attributes for the wrapper element. + * - attributes: A list of HTML attributes for the textarea element. + * - value: The textarea content. + * + * @see template_preprocess_textarea() + * + * @ingroup themeable + */ + @todo: remove this file once http://drupal.org/node/1819284 is resolved. + This is identical to core/modules/system/templates/container.html.twig +#} +{{ value }}