You are here

function text_textarea_process in Content Construction Kit (CCK) 6

Same name in this branch
  1. 6 examples/example_field.php \text_textarea_process()
  2. 6 modules/text/text.module \text_textarea_process()
Same name and namespace in other branches
  1. 6.3 modules/text/text.module \text_textarea_process()
  2. 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']].

2 string references to 'text_textarea_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

examples/example_field.php, line 645
These hooks are defined by field modules, modules that define a new kind of field for insertion in a content type.

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',
    '#title' => t($field['widget']['label']),
    '#description' => t($field['widget']['description']),
    '#required' => $element['#required'],
    '#default_value' => isset($element['#value'][$field_key]) ? $element['#value'][$field_key] : NULL,
    '#rows' => !empty($field['widget']['rows']) ? $field['widget']['rows'] : 10,
    '#weight' => 0,
  );
  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;
}