function uuid_redirector in Universally Unique IDentifier 7
Redirects all UUID URI requests to the appropriate entity page.
1 string reference to 'uuid_redirector'
- uuid_menu in ./
uuid.module - Implements hook_menu().
File
- ./
uuid.module, line 212 - Main module functions for the uuid module.
Code
function uuid_redirector() {
$entity_data = uuid_uri_array_to_data(arg());
$entity_info = entity_get_info($entity_data['entity_type']);
if (empty($entity_info['uuid'])) {
return MENU_NOT_FOUND;
}
$entities = entity_uuid_load($entity_data['entity_type'], array(
$entity_data['uuid'],
));
if (!count($entities)) {
return MENU_NOT_FOUND;
}
$uri = entity_uri($entity_data['entity_type'], current($entities));
if (!drupal_valid_path($uri['path'])) {
return MENU_ACCESS_DENIED;
}
drupal_goto($uri['path'], $uri['options'], 301);
}