You are here

function hook_cck_select_other_process in CCK Select Other 6

Do additional processing or modify the value to be saved.

Parameters

$field The field array:

$edit The full edit array. Useful to grab select_other_list and select_other_text_input values.:

Return value

NULL if not modifying the value. Otherwise, return the value to be saved.

File

./cck_select_other.api.php, line 44
CCK Select Other API Documentation

Code

function hook_cck_select_other_process($field, $edit) {
  if ($edit['select_other_list'] == 'other' && $field['module'] == 'content_taxonomy') {

    // Do somethig like save the actual value as a taxonomy term and return the tid to save.
    $term = array(
      'tid' => NULL,
      'vid' => $field['vid'],
      // Vocabulary id based on Content Taxonomy Field settings.
      'name' => $edit['select_other_text_input'],
    );
    taxonomy_save_term($term);
    return $term['tid'];
  }
}