1 cron_example.module cron_example_add_jobs_to_queue($form, &$form_state)

Submit function used to add the items to the queue.

Related topics

File

modules/examples/cron_example/cron_example.module, line 158
Hook implementations for the Cron Example module.

Code

function cron_example_add_jobs_to_queue($form, &$form_state) {
  $queue = $form_state['values']['queue'];
  $num_items = $form_state['values']['num_items'];

  $queue = BackdropQueue::get($queue);
  for ($i = 1; $i <= $num_items; $i++) {
    $item = new stdClass();
    $item->created = time();
    $item->sequence = $i;
    $queue->createItem($item);
  }
}