function text_textarea_process in Content Construction Kit (CCK) 6.3
Same name and namespace in other branches
- 6 examples/example_field.php \text_textarea_process()
- 6 modules/text/text.module \text_textarea_process()
- 6.2 modules/text/text.module \text_textarea_process()
Process an individual element.
Build the form element. When creating a form using FAPI #process, note that $element['#value'] is already set.
The $fields array is in $form['#field_info'][$element['#field_name']].
1 string reference to 'text_textarea_process'
- text_elements in modules/
text/ text.module - Implementation of FAPI hook_elements().
File
- modules/
text/ text.module, line 437 - Defines simple text field types.
Code
function text_textarea_process($element, $edit, $form_state, $form) {
$field = $form['#field_info'][$element['#field_name']];
$field_key = $element['#columns'][0];
$element[$field_key] = array(
'#type' => 'textarea',
'#default_value' => isset($element['#value'][$field_key]) ? $element['#value'][$field_key] : NULL,
'#rows' => !empty($field['widget']['rows']) ? $field['widget']['rows'] : 10,
'#weight' => 0,
// The following values were set by the content module and need
// to be passed down to the nested element.
'#title' => $element['#title'],
'#description' => $element['#description'],
'#required' => $element['#required'],
'#field_name' => $element['#field_name'],
'#type_name' => $element['#type_name'],
'#delta' => $element['#delta'],
'#columns' => $element['#columns'],
);
if (!empty($field['text_processing'])) {
$filter_key = count($element['#columns']) == 2 ? $element['#columns'][1] : 'format';
$format = isset($element['#value'][$filter_key]) ? $element['#value'][$filter_key] : FILTER_FORMAT_DEFAULT;
$parents = array_merge($element['#parents'], array(
$filter_key,
));
$element[$filter_key] = filter_form($format, 1, $parents);
}
// Used so that hook_field('validate') knows where to flag an error.
$element['_error_element'] = array(
'#type' => 'value',
'#value' => implode('][', array_merge($element['#parents'], array(
$field_key,
))),
);
return $element;
}