You are here

function _webform_render_textarea in Webform 6.2

Same name and namespace in other branches
  1. 5.2 components/textarea.inc \_webform_render_textarea()
  2. 5 components/textarea.inc \_webform_render_textarea()
  3. 6.3 components/textarea.inc \_webform_render_textarea()
  4. 7.4 components/textarea.inc \_webform_render_textarea()
  5. 7.3 components/textarea.inc \_webform_render_textarea()

Build a form item array containing all the properties of this component.

Parameters

$component: An array of information describing the component, directly correlating to the webform_component database schema.

Return value

An array of a form item to be displayed on the client-side webform.

1 call to _webform_render_textarea()
_webform_submission_display_textarea in components/textarea.inc
Display the result of a textfield submission. The output of this function will be displayed under the "results" tab then "submissions".

File

components/textarea.inc, line 93
Webform module textarea component.

Code

function _webform_render_textarea($component) {
  $form_item = array(
    '#type' => 'textarea',
    '#title' => $component['name'],
    '#default_value' => _webform_filter_values($component['value']),
    '#required' => $component['mandatory'],
    '#weight' => $component['weight'],
    '#description' => _webform_filter_descriptions($component['extra']['description']),
    '#rows' => !empty($component['extra']['rows']) ? $component['extra']['rows'] : 5,
    '#cols' => !empty($component['extra']['cols']) ? $component['extra']['cols'] : 60,
    '#attributes' => $component['extra']['attributes'],
    '#resizable' => (bool) $component['extra']['resizable'],
    // MUST be FALSE to disable.
    '#prefix' => '<div class="webform-component-' . $component['type'] . '" id="webform-component-' . $component['form_key'] . '">',
    '#suffix' => '</div>',
  );
  if ($component['extra']['disabled']) {
    $form_item['#attributes']['readonly'] = 'readonly';
  }
  return $form_item;
}