function node_gallery_link_alter in Node Gallery 6
Same name and namespace in other branches
- 6.2 node_gallery.module \node_gallery_link_alter()
Implementation of hook_link_alter().
File
- ./
node_gallery.module, line 465 - Node gallery module file.
Code
function node_gallery_link_alter(&$links, $node) {
if (gallery_config_gateway::get_types('image', $node->type)) {
$conf = gallery_config_gateway::get_by($node->gid, 'id');
if ($conf->content_display == 'gallery') {
foreach ($links as $k => $link) {
if (strpos($k, 'comment') !== FALSE && is_array($link)) {
foreach ($link as $k2 => $v) {
if ($k2 == 'href') {
$links[$k][$k2] = preg_replace('/(\\w+)\\/(\\d+)/i', "\$1/" . $node->gid, $v);
}
if ($k2 == 'query') {
$links[$k][$k2] = is_array($v) ? array_merge($v, array(
'destination' => 'node/' . $node->nid,
)) : $v . "&destinatioin={$node->nid}";
}
}
}
}
}
}
}