You are here

function nodequeue_add_subqueue in Nodequeue 5.2

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

Add a new subqueue to a queue.

Parameters

$qid: The queue id. This should not be the full queue object.

$reference: A reference that uniquely identifies this subqueue. If NULL it will be assigned to the sqid.

3 calls to nodequeue_add_subqueue()
nodequeue_save in ./nodequeue.module
Save a nodequeue. This does not save subqueues; those must be added separately.
smartqueue_author_nodequeue_subqueues in ./authorqueue.module
Implementation of hook_nodequeue_subqueues()
smartqueue_taxonomy_nodequeue_subqueues in ./smartqueue.module
Implementation of hook_nodequeue_subqueues()

File

./nodequeue.module, line 1842

Code

function nodequeue_add_subqueue(&$queue, $title, $reference = NULL) {
  $sqid = db_next_id('{nodequeue_subqueue}_sqid');
  if (empty($reference)) {
    $reference = $sqid;
  }
  $subqueue = new stdClass();
  $subqueue->sqid = $sqid;
  $subqueue->reference = $reference;
  $subqueue->qid = $queue->qid;
  $subqueue->title = $title;
  db_query("INSERT INTO {nodequeue_subqueue} (qid, sqid, reference, title) VALUES (%d, %d, '%s', '%s')", $queue->qid, $sqid, $reference, $title);
  return $subqueue;
}