You are here

function party_devel_generate_parties in Party 8.2

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

The main API function for creating parties

See party_devel_generate_parties_form() for the supported keys in $form_state['values']. Other modules may participate by form_alter() on that form and then handling their data during presave or in own submit handler for the form.

Parameters

string $form_state:

Return value

void

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

File

modules/party_devel/devel_generate.inc, line 17
Devel generate code.

Code

function party_devel_generate_parties($form_state) {
  if (!empty($form_state['values']['kill_parties'])) {
    party_devel_generate_parties_kill($form_state['values']);
  }
  party_devel_generate_parties_pre_party($form_state['values']);
  $start = time();
  for ($i = 1; $i <= $form_state['values']['num_parties']; $i++) {

    // Get list of users we will use.
    party_devel_generate_party_add_party($form_state['values']);
    if (function_exists('drush_log') && $i % drush_get_option('feedback', 1000) == 0) {
      $now = time();
      drush_log(dt('Completed !feedback partiess (!rate party/min)', array(
        '!feedback' => drush_get_option('feedback', 1000),
        '!rate' => drush_get_option('feedback', 1000) * 60 / ($now - $start),
      )), 'ok');
      $start = $now;
    }
  }
  devel_generate_set_message(format_plural($form_state['values']['num_parties'], '1 party created.', 'Finished creating @count parties'));
}