You are here

function content_taxonomy_autocomplete_insert_tags in Content Taxonomy 5

Same name and namespace in other branches
  1. 6.2 content_taxonomy_autocomplete.module \content_taxonomy_autocomplete_insert_tags()
  2. 6 content_taxonomy_autocomplete.module \content_taxonomy_autocomplete_insert_tags()

Insert new tags


$nid the node id:

$terms an array of all <strong>nonexisting</strong> terms.:

Return value

an array of newly inserted term ids

1 call to content_taxonomy_autocomplete_insert_tags()
content_taxonomy_autocomplete_widget in ./content_taxonomy_autocomplete.module
Implementation of hook_widget().


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


function content_taxonomy_autocomplete_insert_tags($terms, $parent = NULL) {
  foreach ($terms as $term) {
    $edit = array(
      'vid' => $term['vid'],
      'name' => $term['name'],
    if ($parent) {
      $edit['parent'] = $parent;
    $status = taxonomy_save_term($edit);
    $saved_terms[$edit['tid']] = $edit['tid'];
  return $saved_terms;