You are here

function taxonomy_guid_get_term in Taxonomy import/export via XML 6.2

Special lookup for terms if they are saved with a URI or GUID

Parameters

guid ID of the term to search for.:

$vid Optional vocab ID to filter by:

Return value

An array of matching term objects.

1 call to taxonomy_guid_get_term()
taxonomy_xml_get_term_by_guid in ./taxonomy_xml.module
Special lookup for terms if they are saved with a URI or GUID

File

taxonomy_guid/taxonomy_guid.module, line 67
Adds a GUID field to taxonomy terms

Code

function taxonomy_guid_get_term($guid, $vid = NULL) {
  if (!$guid) {
    return NULL;
  }
  $query = "SELECT t.tid, t.* FROM {term_data} t WHERE t.guid = '%s'";
  if ($vid) {
    $query .= " AND t.vid = %d";
  }
  $db_result = db_query(db_rewrite_sql($query, 't', 'tid'), $guid, $vid);
  $result = array();
  while ($term = db_fetch_object($db_result)) {
    $result[] = $term;
  }
  return $result;
}