4.7.x form.inc theme_textarea($element)
5.x form.inc theme_textarea($element)
6.x form.inc theme_textarea($element)
7.x form.inc theme_textarea($variables)

Returns HTML for a textarea form element.

Parameters

$variables: An associative array containing:

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

Related topics

1 theme call to theme_textarea()
system_element_info in modules/system/system.module
Implements hook_element_info().

File

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

Code

function theme_textarea($variables) {
  $element = $variables['element'];
  element_set_attributes($element, array(
    'id',
    'name',
    'cols',
    'rows',
  ));
  _form_set_class($element, array(
    'form-textarea',
  ));
  $wrapper_attributes = array(
    'class' => array(
      'form-textarea-wrapper',
    ),
  );

  // Add resizable behavior.
  if (!empty($element['#resizable'])) {
    drupal_add_library('system', 'drupal.textarea');
    $wrapper_attributes['class'][] = 'resizable';
  }
  $output = '<div' . drupal_attributes($wrapper_attributes) . '>';
  $output .= '<textarea' . drupal_attributes($element['#attributes']) . '>' . check_plain($element['#value']) . '</textarea>';
  $output .= '</div>';
  return $output;
}

Comments

peterpoe’s picture

Just remove the line drupal_add_library('system', 'drupal.textarea').
If you want to control Firefox's and WebKit's own resizable behavior with the #resizable property, you can set this in your CSS:

textarea {
  resize: none;
}

.resizable > textarea {
  resize: both;
}
jasom’s picture

I don't like philosophy "print useless code and then fix it with another code". I wrote a tutorial how to remove resize textarea using template.php override. Copy this code into template.php

/**
 * Override of theme('textarea').
 * Deprecate misc/textarea.js in favor of using the 'resize' CSS3 property.
 */
 
function THEMENAME_textarea($variables) {
  $element = $variables ['element'];
  element_set_attributes($element, array('id', 'name', 'cols', 'rows'));
  _form_set_class($element, array('form-textarea'));

  $wrapper_attributes = array(
    'class' => array('form-textarea-wrapper'),
  );

  $output = '<div' . drupal_attributes($wrapper_attributes) . '>';
  $output .= '<textarea' . drupal_attributes($element ['#attributes']) . '>' . check_plain($element ['#value']) . '</textarea>';
  $output .= '</div>';
  return $output;
}
barraponto’s picture

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

#resizable should be added