You are here

function uuid_link_get_nid in UUID Link 6

Returns the nid for a node based on a given uuid.

Parameters

string $uuid: The uuid that needs to be mapped.

1 call to uuid_link_get_nid()
uuid_link_replace_callback in ./uuid_link.module
Replace callback for uuid link tokens.

File

./uuid_link.module, line 217
Provides a filter and UI for adding links to entities that are not affected by changes in URL alias.

Code

function uuid_link_get_nid($uuid) {
  static $static_cache = array();
  if (empty($static_cache['uuid'])) {
    $nid = db_result(db_query(db_rewrite_sql("SELECT n.nid\n       FROM {node} AS n\n       INNER JOIN {uuid_node} AS un ON n.nid = un.nid\n       WHERE un.uuid = '%s'"), $uuid));
    $static_cache[$uuid] = $nid;
  }
  return $static_cache[$uuid];
}