You are here

function uuid_token_values in Universally Unique IDentifier 6

Implementation of hook_token_values().

File

./uuid.module, line 410
Main module functions for the uuid module.

Code

function uuid_token_values($type, $object = NULL, $options = array()) {
  $tokens = array();
  switch ($type) {
    case 'global':
      $tokens['uuid'] = uuid_uuid();
      break;
    case 'user':
      $tokens['uuid'] = isset($object->uuid) ? $object->uuid : NULL;
      break;
    case 'node':
      $tokens['uuid'] = isset($object->uuid) ? $object->uuid : NULL;
      $tokens['revision-uuid'] = isset($object->revision_uuid) ? $object->revision_uuid : NULL;
      $tokens['author-uuid'] = db_result(db_query("SELECT uuid FROM {uuid_users} WHERE uid = %d", $object->uid));
      break;
  }
  return $tokens;
}