You are here

function nodequeue_queue_position in Nodequeue 7.2

Same name and namespace in other branches
  1. 5.2 nodequeue.module \nodequeue_queue_position()
  2. 5 nodequeue.module \nodequeue_queue_position()
  3. 6.2 nodequeue.module \nodequeue_queue_position()
  4. 7.3 nodequeue.module \nodequeue_queue_position()

Get the position of a node in a queue; this queue MUST have only one subqueue or the results of this function will be unpredictable.

Parameters

$qid: Queue ID for the queue with the node in it.

$nid: Node ID for the node you are seeking.

return int Position of the node in the quue.

1 call to nodequeue_queue_position()
NodequeueExternalFetchingUnitTest::testNodequeueQueuePosition in tests/nodequeue.test

File

./nodequeue.module, line 2085
Maintains queues of nodes in arbitrary order.

Code

function nodequeue_queue_position($qid, $nid) {
  $sqid = db_select('nodequeue_subqueue', 'ns')
    ->fields('ns', array(
    'sqid',
  ))
    ->condition('qid', $qid)
    ->range(0, 1)
    ->execute()
    ->fetchField();
  return nodequeue_get_subqueue_position($sqid, $nid);
}