You are here

function devel_generate_batch_content in Devel 7

Form constructor generating in batches.

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

File

devel_generate/devel_generate_batch.inc, line 10

Code

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