You are here

function uuid_devel_load_by_uuid in Universally Unique IDentifier 7

Page callback to display Devel information about a UUID entity.

1 string reference to 'uuid_devel_load_by_uuid'
uuid_menu in ./uuid.module
Implements hook_menu().

File

./uuid.admin.inc, line 39
Administration functions for the uuid module.

Code

function uuid_devel_load_by_uuid($entity_type, $entity) {
  $info = entity_get_info($entity_type);
  if (isset($info['uuid']) && $info['uuid'] == TRUE && !empty($info['entity keys']['uuid'])) {

    // Get the keys for local ID and UUID.
    $uuid_key = $info['entity keys']['uuid'];
    $uuid_entities = entity_uuid_load($entity_type, array(
      $entity->{$uuid_key},
    ));

    // @codingStandardsIgnoreStart
    return kdevel_print_object(reset($uuid_entities), '$' . $entity_type . '->');

    // @codingStandardsIgnoreEnd
  }
  else {
    return t("This entity doesn't support UUID.");
  }
}