You are here

function _taxonomy_xml_get_term_placeholder in Taxonomy import/export via XML 6

Same name and namespace in other branches
  1. 5.2 taxonomy_xml.module \_taxonomy_xml_get_term_placeholder()
  2. 5 taxonomy_xml.module \_taxonomy_xml_get_term_placeholder()
  3. 6.2 taxonomy_xml.module \_taxonomy_xml_get_term_placeholder()
  4. 7 taxonomy_xml.process.inc \_taxonomy_xml_get_term_placeholder()

Either fetch the named term if it exists, or return a useful placeholder.

The returned term has a 'synonyms_array' because that's easier to work with than string concats in odd places.

4 calls to _taxonomy_xml_get_term_placeholder()
taxonomy_xml_csv_parse in ./csv_format.inc
Scan the input CSV file and create a taxonomy structure out of it.
taxonomy_xml_mesh_parse in ./mesh_format.inc
Reads a XML file and creates the term definitions found in it.
taxonomy_xml_rdf_parse in ./rdf_format.inc
Read in RDF taxonomies and vocabularies. Create vocabs and terms as needed.
taxonomy_xml_tcs_parse in ./tcs_format.inc
Reads a TCS file and creates the term definitions found in it.

File

./taxonomy_xml.module, line 860
taxonomy_xml.module This module makes it possible to import and export taxonomies as XML documents.

Code

function _taxonomy_xml_get_term_placeholder($name, $vid = 0) {

  #dpm("Getting placeholder '$name' vocab:$vid");
  if ($name) {
    $term = taxonomy_xml_get_term_by_name_from_vocab($name, $vid);
  }
  else {

    // Assert input is OK. Just paranoia
    drupal_set_message(t("Asked to make a term with no name ... are you sure?"), 'error');
  }
  if (!$term) {
    $term = (object) array(
      'name' => $name,
      'vid' => $vid,
      'description' => '',
      'weight' => 0,
      'predicates' => array(),
      'synonyms_array' => array(),
    );
  }
  else {

    #drupal_set_message(t("A term called '!name' already exists. We will just update information onto it.", array('!name' => l($term->name, 'admin/content/taxonomy/edit/term/'. $term->tid) )), 'trace');
  }
  return $term;
}