You are here

function node_gallery_gallery_to_arg in Node Gallery 6.2

Same name and namespace in other branches
  1. 6.3 node_gallery.module \node_gallery_gallery_to_arg()

File

./node_gallery.module, line 518
Node gallery module file

Code

function node_gallery_gallery_to_arg($arg) {
  if (!is_numeric($arg)) {
    return $arg;
  }
  $types = node_gallery_get_types('all');
  $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;
  }
}