You are here

function taxonomy_xml_set_term_guid in Taxonomy import/export via XML 6.2

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

Insert a URI serialization into a term object.

Does NOT actually save the value, but puts values that will be saved by the appropriate handlers (CCK, taxonomy_enhancer or rdf) when the term is saved.

1 call to taxonomy_xml_set_term_guid()
taxonomy_xml_canonicize_predicates in ./taxonomy_xml.module
Convert aliased predicates into common ones.

File

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

Code

function taxonomy_xml_set_term_guid(&$term, $guid) {
  $term->guid = $guid;

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

    // taxonomy_enhancer swaps between these two versions of the same data when reading and writing
    // Do both, as te is unstable.
  }
  if (module_exists('rdf')) {

    // Set a statement that RDF.module can serialize
    $term->rdf[] = array(
      'predicate' => 'owl:sameAs',
      'object' => $guid,
    );
  }

  // @todo other ways of noting this?
}