function node_gallery_gallery_to_arg in Node Gallery 6.3
Same name and namespace in other branches
- 6.2 node_gallery.module \node_gallery_gallery_to_arg()
to_arg() function for hook_menu().
Parameters
$arg: The argument in the wildcard.
Return value
The nid of the gallery.
File
- ./
node_gallery.module, line 1042 - Node gallery module file.
Code
function node_gallery_gallery_to_arg($arg) {
if (!is_numeric($arg)) {
return $arg;
}
$types = node_gallery_get_types('gallery');
$nid = $arg;
$node = node_load($nid);
// is the current node used in any ng relationships?
if (in_array($node->type, $types)) {
// If looking at an image, we'll want the nid to be the gallery nid
if (in_array($node->type, node_gallery_get_types('image'))) {
return $node->gid;
}
else {
return $nid;
}
}
else {
// this is not a ng node
return $nid;
}
}