function node_gallery_link_alter in Node Gallery 6.2
Same name and namespace in other branches
- 6 node_gallery.module \node_gallery_link_alter()
Implementation of hook_link_alter().
File
- ./
node_gallery.module, line 690 - Node gallery module file
Code
function node_gallery_link_alter(&$links, $node) {
if (in_array($node->type, (array) node_gallery_get_types('image'))) {
$config = node_gallery_get_image_parent_gallery_config($node);
if ($config['image_comment'] == '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}";
}
}
}
}
}
}
}