function views_data_export_views_data_export_batch_alter in Views data export 7.4
Same name and namespace in other branches
- 6.3 views_data_export.drush.inc \views_data_export_views_data_export_batch_alter()
- 6 views_data_export.drush.inc \views_data_export_views_data_export_batch_alter()
- 6.2 views_data_export.drush.inc \views_data_export_views_data_export_batch_alter()
- 7 views_data_export.drush.inc \views_data_export_views_data_export_batch_alter()
- 7.3 views_data_export.drush.inc \views_data_export_views_data_export_batch_alter()
Implementation of hook_views_data_export_batch_alter()
File
- ./
views_data_export.drush.inc, line 220
Code
function views_data_export_views_data_export_batch_alter(&$batch, &$final_destination, &$querystring) {
// Copy the batch, because we're going to monkey with it, a lot!
$new_batch = $batch;
$view_name = $new_batch['view_name'];
$display_id = $new_batch['display_id'];
$ok_to_override = _drush_views_data_export_override_batch();
// Make sure we do nothing if we are called not following the execution of
// our drush command. This could happen if the file with this function in it
// is included during the normal execution of the view
if (!$ok_to_override[$view_name][$display_id]) {
return;
}
$options = $ok_to_override[$view_name][$display_id];
// We actually never return from the drupal_alter, but
// use drush's batch system to run the same batch
// Add a final callback
$new_batch['operations'][] = array(
'_drush_views_data_export_batch_finished',
array(
$batch['eid'],
$options['output_file'],
),
);
batch_set($new_batch);
$new_batch =& batch_get();
// Drush handles the different processes, so instruct BatchAPI not to.
$new_batch['progressive'] = FALSE;
// Process the batch using drush.
drush_backend_batch_process();
// Instruct the view display plugin that it shouldn't set a batch.
$batch = array();
}