You are here

function social_event_managers_batch_alter in Open Social 8.7

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \social_event_managers_batch_alter()
  2. 8.5 modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \social_event_managers_batch_alter()
  3. 8.6 modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \social_event_managers_batch_alter()
  4. 8.8 modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \social_event_managers_batch_alter()
  5. 10.3.x modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \social_event_managers_batch_alter()
  6. 10.0.x modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \social_event_managers_batch_alter()
  7. 10.1.x modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \social_event_managers_batch_alter()
  8. 10.2.x modules/social_features/social_event/modules/social_event_managers/social_event_managers.module \social_event_managers_batch_alter()

Implements hook_batch_alter().

File

modules/social_features/social_event/modules/social_event_managers/social_event_managers.module, line 400
Contains social_event_managers.module.

Code

function social_event_managers_batch_alter(&$batch) {
  if (!isset($batch['source_url'])) {
    return;
  }
  $actions = [
    'social_event_enrolments_export_enrollments_action',
    'social_event_managers_send_email_action',
    'social_event_managers_delete_event_enrollment_action',
    'social_event_an_enroll_enrolments_export_action',
    'social_event_an_enroll_send_email_action',
  ];

  /** @var \Drupal\Core\Url $url */
  $url =& $batch['source_url'];
  if ($url
    ->getRouteName() === 'social_event_managers.vbo.confirm' || $url
    ->getRouteName() === 'views_bulk_operations.confirm' || $url
    ->getRouteName() === 'views_bulk_operations.execute_batch') {

    // Get the action ID.
    $action_id = _social_event_managers_get_action_id($batch);
    $batch['sets'][0]['results']['action'] = $action_id;
    if (in_array($action_id, $actions, TRUE)) {
      $batch['sets'][0]['finished'] = '_social_event_managers_action_batch_finish';
    }
  }
}