You are here

function content_taxonomy_autocomplete_form2data in Content Taxonomy 6

Same name and namespace in other branches
  1. 6.2 content_taxonomy_autocomplete.module \content_taxonomy_autocomplete_form2data()

Helper function to transpose the values returned by submitting the content_taxonomy_autcomplete to the format to be stored in the field

1 call to content_taxonomy_autocomplete_form2data()
content_taxonomy_autocomplete_validate in ./content_taxonomy_autocomplete.module
Validation function for the content_taxonomy_autocomplete element

File

./content_taxonomy_autocomplete.module, line 245
Defines a widget type for content_taxonomy with autocomplete

Code

function content_taxonomy_autocomplete_form2data($extracted_ids, $field, $element) {
  $existing_tids = is_array($extracted_ids['existing_tids']) ? $extracted_ids['existing_tids'] : array();
  $new_tids = array();
  if (is_array($extracted_ids['non_existing_terms'])) {
    if ($field['widget']['extra_parent']) {
      $new_tids = content_taxonomy_autocomplete_insert_tags($extracted_ids['non_existing_terms'], $field['widget']['extra_parent']);
    }
    else {
      $new_tids = content_taxonomy_autocomplete_insert_tags($extracted_ids['non_existing_terms'], content_taxonomy_field_get_parent($field));
    }
  }
  return content_transpose_array_rows_cols(array(
    $element['#columns'][0] => array_merge($existing_tids, $new_tids),
  ));
}