You are here

function node_gallery_api_seek_from_current_item in Node Gallery 7

Returns the nid of the image +/-N steps away from the current image node.

Parameters

int $ngid: The nid of the gallery to query.

int $nid: The nid of the current image.

int $seek: The postive or negative number of slots to seek to.

bool $reset: (optional) If TRUE, clears the caches. Defaults to FALSE.

2 calls to node_gallery_api_seek_from_current_item()
node_gallery_api_get_next_item in ./node_gallery_api.inc
Gets the next image in the gallery.
node_gallery_api_get_prev_item in ./node_gallery_api.inc
Gets the previous image in the gallery.

File

./node_gallery_api.inc, line 674
Node Gallery API function

Code

function node_gallery_api_seek_from_current_item($ngid, $nid, $seek, $reset) {
  $item_list = node_gallery_api_get_item_list($ngid, $reset);
  $current_position = node_gallery_api_get_item_position($ngid, $nid, $reset);
  $current_index = $current_position - 1;
  $seek_index = $current_index + $seek;
  return isset($item_list[$seek_index]) ? $item_list[$seek_index] : NULL;
}