You are here

function devel_batch_generate_content in Devel 6

Functions called from FAPI:

1 call to devel_batch_generate_content()
devel_generate_content_form_submit in ./devel_generate.module
FormAPI submission to generate nodes.

File

./devel_generate_batch.inc, line 12

Code

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

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

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

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

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