You are here

function _taxonomy_csv_term_save in Taxonomy CSV import/export 7.4

Save by reference an internally formatted term object.

Parameters

$term: A term object to save by reference. Term is an object containing:

  • 'name' ; term name string,
  • 'vid' ; the vocabulary id,

and eventually:

  • 'tid' ; term id in case of an update,
  • 'description' ; description string,
  • 'weight' ; weight integer,
  • 'parents' ; array of first level parent tids,
  • 'relations' ; array of related tids,
  • 'synonyms' ; array of synonyms terms names strings,

Return value

Status value (SAVED_NEW or SAVED_UPDATED). Term is updated with its tid.

1 call to _taxonomy_csv_term_save()
taxonomy_csv_term_import in import/taxonomy_csv.import.line.api.inc
Update or create a term with the given name in the given vocabulary and given parent.

File

./taxonomy_csv.term.api.inc, line 377
Find, get and set full or detail term items.

Code

function _taxonomy_csv_term_save(&$term) {
  $term_to_save = _taxonomy_csv_term_format_regular($term);
  $result = taxonomy_term_save($term_to_save);

  // Update term.
  $term->tid = $term_to_save->tid;
  return $result;
}