You are here

function _uuid_path_load_url_aliases in Universally Unique IDentifier 7

Loads url aliases in the corresponding entity.

1 call to _uuid_path_load_url_aliases()
uuid_path_entity_uuid_load in uuid_path/uuid_path.module
Implements hook_entity_uuid_load().

File

uuid_path/uuid_path.module, line 25
UUID path module functions.

Code

function _uuid_path_load_url_aliases(&$entities, $entity_type) {
  $info = entity_get_info($entity_type);

  // We only care about entities with URLs.
  if (!isset($info['uri callback'])) {
    return;
  }
  $callback = $info['uri callback'];
  foreach ($entities as $id => $entity) {
    $path = $callback($entity);
    $aliases = _uuid_path_url_alias_load($path['path']);

    // Ignore local IDs.
    foreach ($aliases as &$alias) {
      unset($alias->pid);
      unset($alias->source);
    }
    $entities[$id]->url_alias = $aliases;
  }
}