function oa_core_get_alias in Open Atrium Core 7.2
Return what the defined alias will eventually be for $nid
1 call to oa_core_get_alias()
- oa_core_tokens in ./
oa_core.module - Implements hook_tokens().
File
- ./
oa_core.module, line 1420
Code
function oa_core_get_alias($nid, $languagecode = NULL) {
$cache =& drupal_static('oa_core_alias', array());
$cachekey = $nid . ':' . $languagecode;
if (isset($cache[$cachekey])) {
return $cache[$cachekey];
}
if ($node = node_load($nid)) {
$uri = entity_uri('node', $node);
$path = drupal_get_path_alias($uri['path'], $languagecode);
if (!isset($node->path['pathauto'])) {
module_load_include('inc', 'pathauto');
// return what the proper alias for this node will eventually be
// don't use 'update' yet since the drupal_get_path_alias() will still be cached
$path = pathauto_create_alias('node', 'return', $uri['path'], array(
'node' => $node,
), $node->type, $languagecode);
}
$cache[$cachekey] = $path;
}
else {
$cache[$cachekey] = FALSE;
}
return $cache[$cachekey];
}