function text_textfield_process in Content Construction Kit (CCK) 6
Same name in this branch
- 6 examples/example_field.php \text_textfield_process()
- 6 modules/text/text.module \text_textfield_process()
Same name and namespace in other branches
- 6.3 modules/text/text.module \text_textfield_process()
- 6.2 modules/text/text.module \text_textfield_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']].
2 string references to 'text_textfield_process'
- text_elements in examples/
example_field.php - Implementation of FAPI hook_elements().
- text_elements in modules/
text/ text.module - Implementation of FAPI hook_elements().
File
- modules/
text/ text.module, line 378 - Defines simple text field types.
Code
function text_textfield_process($element, $edit, $form_state, $form) {
$field = $form['#field_info'][$element['#field_name']];
$field_key = $element['#columns'][0];
$delta = $element['#delta'];
$element[$field_key] = array(
'#type' => 'textfield',
'#title' => $element['#title'],
'#description' => $element['#description'],
'#required' => $element['#required'],
'#default_value' => isset($element['#value'][$field_key]) ? $element['#value'][$field_key] : NULL,
'#autocomplete_path' => $element['#autocomplete_path'],
);
if (!empty($field['max_length'])) {
$element[$field_key]['#maxlength'] = $field['max_length'];
}
if (!empty($field['text_processing'])) {
$filter_key = $element['#columns'][1];
$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);
}
return $element;
}