You are here

function uuid_entity_uuid_uri in Universally Unique IDentifier 7

Generates a UUID URI for an entity.

Parameters

object $entity: The entity to use for generating the UUID URI.

string $entity_type: The type of entity being used.

Return value

string The generated UUID URI or normal URI if entity doesn't support UUIDs.

File

./uuid.inc, line 113
Handling of universally unique identifiers.

Code

function uuid_entity_uuid_uri($entity, $entity_type) {
  $entity_info = entity_get_info($entity_type);
  if (empty($entity_info['uuid'])) {
    $uri = $entity_info['uri callback']($entity);
    return $uri['path'];
  }
  if (isset($entity_info['uuid uri callback'])) {
    return $entity_info['uuid uri callback']($entity);
  }
  return "uuid/{$entity_type}/" . $entity->{$entity_info['entity keys']['uuid']};
}