You are here

function nodequeue_arrange_subqueue_form in Nodequeue 5.2

Same name and namespace in other branches
  1. 6.2 includes/nodequeue.admin.inc \nodequeue_arrange_subqueue_form()
  2. 7.3 includes/nodequeue.admin.inc \nodequeue_arrange_subqueue_form()
  3. 7.2 includes/nodequeue.admin.inc \nodequeue_arrange_subqueue_form()

Form used for arranging a queue

1 string reference to 'nodequeue_arrange_subqueue_form'
nodequeue_arrange_subqueue in ./nodequeue.module
View the contents of a subqueue, with links to re-order the queue.

File

./nodequeue.module, line 903

Code

function nodequeue_arrange_subqueue_form($queue, $sqid, $nids) {
  $form['qid'] = array(
    '#type' => 'value',
    '#value' => $queue->qid,
  );
  $form['sqid'] = array(
    '#type' => 'hidden',
    '#value' => $sqid,
  );
  $form['order'] = array(
    '#type' => 'hidden',
    '#id' => 'nodequeue-order',
    '#default_value' => implode(',', array_keys($nids)),
  );
  $form['add'] = array(
    '#type' => 'textfield',
    '#title' => t('Select title to add'),
    '#autocomplete_path' => "nodequeue/autocomplete/{$sqid}",
    '#default_value' => '',
  );

  // For use by the validate handler
  $form['nid'] = array(
    '#type' => 'value',
    '#value' => 0,
  );
  $form['add_submit'] = array(
    '#type' => 'submit',
    '#attributes' => array(
      'class' => 'nodequeue-add',
    ),
    '#value' => t('Add'),
  );
  $form['save'] = array(
    '#type' => 'submit',
    '#attributes' => array(
      'class' => 'nodequeue-hide-if-not-js-hide nodequeue-save',
    ),
    '#value' => t('Save'),
  );
  $form['clear'] = array(
    '#type' => 'submit',
    '#attributes' => array(
      'class' => 'nodequeue-clear',
    ),
    '#value' => t('Clear'),
  );
  $form['reverse_click'] = array(
    '#type' => 'submit',
    '#attributes' => array(
      'class' => 'nodequeue-reverse',
    ),
    '#value' => t('Reverse'),
  );
  $form['shuffle'] = array(
    '#type' => 'submit',
    '#attributes' => array(
      'class' => 'nodequeue-shuffle',
    ),
    '#value' => t('Shuffle'),
  );

  // Store the original order.
  $form['nids'] = array(
    '#type' => 'value',
    '#value' => $nids,
  );
  $form['added_nids'] = array(
    '#type' => 'hidden',
    '#default_value' => '',
  );
  $settings = array(
    'nodequeue-table' => array(
      // The gadget that stores our the order of items.
      'order' => 'input#nodequeue-order',
      // The buttons that do stuff.
      'up' => 'a.nodequeue-move-up',
      'down' => 'a.nodequeue-move-down',
      'top' => 'a.nodequeue-move-front',
      'bottom' => 'a.nodequeue-move-back',
      'remove' => 'a.nodequeue-remove',
      // The button that adds an item
      'add' => 'input.nodequeue-add',
      // The buttom to clear the queue
      'clear_list' => 'input.nodequeue-clear',
      // Path for js to shuffle the queue
      'shuffle' => 'input.nodequeue-shuffle',
      // Path for js to reverse the queue
      'reverse' => 'input.nodequeue-reverse',
      // Path for ajax on adding an item
      'path' => url('nodequeue/ajax/add', NULL, NULL, TRUE),
      // Which items to post when adding
      'post' => array(
        '#edit-sqid',
        '#edit-add',
      ),
      // Where to get the id of an item
      'tr' => 'nodequeue-row-',
      'row_class' => 'tr.nodequeue-row',
      // Where to put the extra (we're storing a nid)
      'extra' => '#edit-added-nids',
      // What item to focus on ready
      'focus' => '#edit-add',
      // What item(s) to clear after add
      'clear' => array(
        '#edit-add',
      ),
      // What hidden class to show as soon as anything has changed that needs saving.
      'hidden' => '.nodequeue-js-hide',
      // Do we add to the top or the bottom?
      'add_location' => $queue->reverse ? 'top' : 'bottom',
    ),
  );
  drupal_add_js(array(
    'nodequeue' => $settings,
  ), 'setting');
  drupal_add_css(drupal_get_path('module', 'nodequeue') . '/nodequeue.css');
  return $form;
}