You are here

function field_defaults_batch_run in Field Defaults 7

Same name and namespace in other branches
  1. 7.2 field_defaults.module \field_defaults_batch_run()

The batch callback.

2 calls to field_defaults_batch_run()
_field_defaults_translation_submit in ./field_defaults.module
Submit handler for field ui translation form
_field_defaults_ui_submit in ./field_defaults.module
Submit handler for field ui form

File

./field_defaults.module, line 179
field_defaults.module

Code

function field_defaults_batch_run($variables) {
  $batch = array(
    'operations' => array(),
    'finished' => 'field_defaults_batch_finished',
    'title' => t('Update field defaults'),
    'init_message' => t('Grabbing entities'),
    'progress_message' => t('Processed @current out of @total.'),
    'error_message' => t('updated has encountered an error.'),
  );
  $redirect = isset($variables['redirect']) ? $variables['redirect'] : NULL;

  // Run each language separate
  foreach ($variables['languages'] as $langcode => $value) {

    // unchecked have no values but still have keys
    if ($value) {
      $batch['operations'][] = array(
        'field_defaults_batch_process',
        array(
          $variables,
          $langcode,
        ),
      );
    }
  }
  batch_set($batch);
  batch_process($redirect);
}