function hosting_alias_node_load in Hosting 7.3
Same name and namespace in other branches
- 7.4 alias/hosting_alias.module \hosting_alias_node_load()
Implements hook_node_load().
File
- alias/
hosting_alias.module, line 394 - Allow sites to have domain aliases that they can be accessed with.
Code
function hosting_alias_node_load($nodes, $types) {
foreach ($nodes as $nid => &$node) {
if ($node->type == 'site') {
// XXX: this returns only the first redirection status. it
// works since they are all set to the same in hook_insert(),
// but we should return an associative alias => redirection
// array instead.
$nodes[$nid]->redirection = db_query("SELECT redirection FROM {hosting_site_alias} WHERE vid = :vid", array(
':vid' => $node->vid,
))
->fetchField();
// Only retrieves custom aliases, as they are all that can be modified.
$nodes[$nid]->aliases = hosting_alias_get_aliases($node, HOSTING_ALIAS_CUSTOM);
$nodes[$nid]->aliases_automatic = hosting_alias_get_aliases($node, HOSTING_ALIAS_AUTOMATIC);
}
}
}