You are here

function taxonomy_xml_get_term_guid in Taxonomy import/export via XML 6.2

Same name and namespace in other branches
  1. 7 taxonomy_xml.module \taxonomy_xml_get_term_guid()

Return (and remember) the URI associated with this term.

Abstracted into a getter, because it may be serialized in different ways.

3 calls to taxonomy_xml_get_term_guid()
taxonomy_xml_add_terms_as_rdf in ./rdf_format.inc
Given a list of terms, append definitions of them to the passed DOM container
taxonomy_xml_get_term_uri in ./taxonomy_xml.module
Deprecated, to avoid conflict with D7 entities, which use uri for their own purpose
taxonomy_xml_taxonomy_term_load in ./taxonomy_xml.module
Appends any missing data to the given term - by ref.

File

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

Code

function taxonomy_xml_get_term_guid(&$term) {

  // taxonomy_guid will support this in core, if enabled.
  if (!empty($term->guid)) {
    return $term->guid;
  }

  // CCK (only supported via nat or enhancer)
  if (isset($term->field_guid)) {
    $term->guid = $term->field_guid[0]['#value'];
    return $term->guid;
  }

  // RDF.module
  if (module_exists('rdf')) {
    $term_url = taxonomy_xml_rdf_taxonomy_term_path($term);
    $about_term = rdf_query($term_url, 'owl:sameAs', NULL, array())
      ->to_array();
    foreach ($about_term as $sid => $statement) {
      $term->guid = $statement[2];
      return $term->guid;
    }
  }
}