You are here

function content_taxonomy_autocomplete_value in Content Taxonomy 6

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

Value for a content taxonomy autocomplete field

returns the taxonomy term name for term ids

1 string reference to 'content_taxonomy_autocomplete_value'
content_taxonomy_autocomplete_widget in ./content_taxonomy_autocomplete.module
Implementation of hook_widget().

File

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

Code

function content_taxonomy_autocomplete_value($element, $edit = FALSE) {
  $field_key = $element['#columns'][0];
  $terms = array();
  if (count($element['#default_value'])) {
    foreach ($element['#default_value'] as $delta => $entry) {
      $terms[] = taxonomy_get_term($entry[$field_key]);
    }
  }
  $value = content_taxonomy_autocomplete_merge_tags($terms, $element['#vid']);
  $value = !empty($value) ? $value : NULL;
  return array(
    $field_key => $value,
  );
}