You are here

function queue_example_show_queue in Examples for Developers 7

Submit function for the show-queue button.

Related topics

1 string reference to 'queue_example_show_queue'
queue_example_add_remove_form in queue_example/queue_example.module
Form generator for managing the queue.

File

queue_example/queue_example.module, line 178
Examples demonstrating the Drupal Queue API.

Code

function queue_example_show_queue($form, &$form_state) {
  $queue = DrupalQueue::get($form_state['values']['queue_name']);

  // There is no harm in trying to recreate existing.
  $queue
    ->createQueue();

  // Get the number of items.
  $count = $queue
    ->numberOfItems();

  // Update the form item counter.
  $form_state['storage']['insert_counter'] = $count + 1;

  // Unset the string_to_add textbox.
  unset($form_state['input']['string_to_add']);
  $form_state['rebuild'] = TRUE;
}