You are here

function party_devel_generate_batch_parties in Party 8.2

Same name and namespace in other branches
  1. 7 modules/party_devel/devel_generate_batch.inc \party_devel_generate_batch_parties()

Functions called from FAPI:

1 call to party_devel_generate_batch_parties()
party_devel_generate_parties_form_submit in modules/party_devel/party_devel.module

File

modules/party_devel/devel_generate_batch.inc, line 9
Devel Generate batch handling functions using the BatchAPI

Code

function party_devel_generate_batch_parties($form_state) {
  $operations = array();

  // Setup the batch operations and save the variables.
  $operations[] = array(
    'party_devel_generate_batch_parties_pre_party',
    array(
      $form_state['values'],
    ),
  );

  // add the kill operation
  if ($form_state['values']['kill_parties']) {
    $operations[] = array(
      'party_devel_generate_batch_parties_kill',
      array(),
    );
  }

  // add the operations to create the products
  for ($num = 0; $num < $form_state['values']['num_parties']; $num++) {
    $operations[] = array(
      'party_devel_generate_batch_parties_add_party',
      array(),
    );
  }

  // start the batch
  $batch = array(
    'title' => t('Generating Parties'),
    'operations' => $operations,
    'finished' => 'party_devel_generate_batch_finished',
    'file' => drupal_get_path('module', 'party_devel') . '/devel_generate_batch.inc',
  );
  batch_set($batch);
}