You are here

function nodequeue_set_subqueue_positions in Nodequeue 7.2

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

Get the position of a node in several subqueues.

3 calls to nodequeue_set_subqueue_positions()
nodequeue_apachesolr_index_document_build_node in ./nodequeue.module
Implements hook_apachesolr_index_document_build_ENTITY_TYPE().
nodequeue_node_links in ./nodequeue.module
Returns an array of nodequeue links for a node.
nodequeue_node_tab in includes/nodequeue.admin.inc
Display the queue controls for a node.

File

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

Code

function nodequeue_set_subqueue_positions(&$subqueues, $nid) {
  if (empty($subqueues)) {
    return;
  }
  $query = db_select('nodequeue_nodes', 'n')
    ->fields('n', array(
    'sqid',
  ))
    ->condition('sqid', array_keys($subqueues), 'IN')
    ->condition('nid', $nid)
    ->groupBy('sqid');
  $query
    ->addExpression('MIN(position)', 'position');
  $result = $query
    ->execute();
  foreach ($result as $obj) {
    $subqueues[$obj->sqid]->position = $obj->position;
  }
}