You are here

function nodequeue_nodequeue_form_submit in Nodequeue 7.2

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

Implements hook_nodequeue_form_submit().

File

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

Code

function nodequeue_nodequeue_form_submit(&$queue, $form_state) {

  // This will add a single subqueue to our new queue.
  if (!isset($queue->qid) && !isset($queue->add_subqueue)) {

    // A 0 will set the reference to the sqid of the queue.
    $queue->add_subqueue = array(
      0 => $queue->title,
    );
  }

  //If the qid is set at this point, we're saving an existing queue.
  if (isset($queue->qid)) {

    //We don't check to see if the title has been updated since the $queue object already matches $form_state['values'].
    db_update('nodequeue_subqueue')
      ->fields(array(
      'title' => $form_state['values']['title'],
    ))
      ->condition('qid', $queue->qid)
      ->execute();
  }
}