You are here

function social_group_batch_alter in Open Social 8.9

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

Implements hook_batch_alter().

File

modules/social_features/social_group/social_group.module, line 2095
The Social group module.

Code

function social_group_batch_alter(&$batch) {
  if (!isset($batch['source_url'])) {
    return;
  }
  $actions = [
    'social_group_members_export_member_action',
    'social_group_change_member_role_action',
    'social_group_delete_group_content_action',
    'social_group_send_email_action',
  ];

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

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