function _uuid_path_save_url_aliases in Universally Unique IDentifier 7
Saves the received url aliases.
1 call to _uuid_path_save_url_aliases()
- uuid_path_entity_uuid_save in uuid_path/
uuid_path.module - Implements hook_entity_uuid_save().
File
- uuid_path/
uuid_path.module, line 50 - UUID path module functions.
Code
function _uuid_path_save_url_aliases(&$entity, $entity_type) {
$info = entity_get_info($entity_type);
// We only care when there is a url callback.
if (!isset($info['uri callback'])) {
return FALSE;
}
$callback = $info['uri callback'];
$uri = $callback($entity);
$path = $uri['path'];
// Delete existing aliases.
path_delete(array(
'source' => $path,
));
// Continue if aliases are present.
if (empty($entity->url_alias)) {
return FALSE;
}
foreach ($entity->url_alias as $alias) {
$entry = (array) $alias;
$entry['source'] = $path;
path_save($entry);
}
}