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 160
Demonstrates use of the Cron API in Backdrop - hook_cron()

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);
  }
}