'',
'form_key' => NULL,
'pid' => 0,
'weight' => 0,
'value' => '',
'mandatory' => 0,
'extra' => array(
'cols' => '',
'rows' => '',
'title_display' => 0,
'resizable' => 1,
'disabled' => 0,
'description' => '',
'attributes' => array(),
),
);
}
/**
* Implementation of _webform_theme_component().
*/
function _webform_theme_textarea() {
return array(
'webform_display_textarea' => array(
'render element' => 'element',
),
);
}
/**
* Implementation of _webform_edit_component().
*/
function _webform_edit_textarea($component) {
$form = array();
$form['value'] = array(
'#type' => 'textarea',
'#title' => t('Default value'),
'#default_value' => $component['value'],
'#description' => t('The default value of the field.') . theme('webform_token_help'),
'#cols' => 60,
'#rows' => 5,
'#weight' => 0,
);
$form['display']['cols'] = array(
'#type' => 'textfield',
'#title' => t('Width'),
'#default_value' => $component['extra']['cols'],
'#description' => t('Width of the textarea.') . ' ' . t('Leaving blank will use the default size.'),
'#size' => 5,
'#maxlength' => 10,
'#parents' => array('extra', 'cols'),
);
$form['display']['rows'] = array(
'#type' => 'textfield',
'#title' => t('Height'),
'#default_value' => $component['extra']['rows'],
'#description' => t('Height of the textarea.') . ' ' . t('Leaving blank will use the default size.'),
'#size' => 5,
'#maxlength' => 10,
'#parents' => array('extra', 'rows'),
);
$form['display']['resizable'] = array(
'#type' => 'checkbox',
'#title' => t('Resizable'),
'#description' => t('Make this field resizable by the user.'),
'#weight' => 2,
'#default_value' => $component['extra']['resizable'],
'#parents' => array('extra', 'resizable'),
);
$form['display']['disabled'] = array(
'#type' => 'checkbox',
'#title' => t('Disabled'),
'#return_value' => 1,
'#description' => t('Make this field non-editable. Useful for setting an unchangeable default value.'),
'#weight' => 11,
'#default_value' => $component['extra']['disabled'],
'#parents' => array('extra', 'disabled'),
);
return $form;
}
/**
* Implementation of _webform_render_component().
*/
function _webform_render_textarea($component, $value = NULL, $filter = TRUE) {
$element = array(
'#type' => 'textarea',
'#title' => $filter ? _webform_filter_xss($component['name']) : $component['name'],
'#title_display' => $component['extra']['title_display'] ? $component['extra']['title_display'] : 'before',
'#default_value' => $filter ? _webform_filter_values($component['value']) : $component['value'],
'#required' => $component['mandatory'],
'#weight' => $component['weight'],
'#description' => $filter ? _webform_filter_descriptions($component['extra']['description']) : $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.
'#theme_wrappers' => array('webform_element'),
'#webform_component' => $component,
);
if ($component['extra']['disabled']) {
$element['#attributes']['readonly'] = 'readonly';
}
if (isset($value)) {
$element['#default_value'] = $value[0];
}
return $element;
}
/**
* Implementation of _webform_display_component().
*/
function _webform_display_textarea($component, $value, $format = 'html') {
return array(
'#title' => $component['name'],
'#weight' => $component['weight'],
'#theme' => 'webform_display_textarea',
'#theme_wrappers' => $format == 'html' ? array('webform_element') : array('webform_element_text'),
'#format' => $format,
'#value' => isset($value[0]) ? $value[0] : '',
'#webform_component' => $component,
);
}
/**
* Format the output of data for this component.
*/
function theme_webform_display_textarea($variables) {
$element = $variables['element'];
$output = $element['#format'] == 'html' ? str_replace("\n", '
', check_plain($element['#value'])) : $element['#value'];
if (strlen($output) > 80) {
$output = ($element['#format'] == 'html') ? '