You are here

function _social_post_mass_update_batch_finished in Open Social 10.3.x

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_post/social_post.admin.inc \_social_post_mass_update_batch_finished()
  2. 8.3 modules/social_features/social_post/social_post.admin.inc \_social_post_mass_update_batch_finished()
  3. 8.4 modules/social_features/social_post/social_post.admin.inc \_social_post_mass_update_batch_finished()
  4. 8.5 modules/social_features/social_post/social_post.admin.inc \_social_post_mass_update_batch_finished()
  5. 8.6 modules/social_features/social_post/social_post.admin.inc \_social_post_mass_update_batch_finished()
  6. 8.7 modules/social_features/social_post/social_post.admin.inc \_social_post_mass_update_batch_finished()
  7. 8.8 modules/social_features/social_post/social_post.admin.inc \_social_post_mass_update_batch_finished()
  8. 10.0.x modules/social_features/social_post/social_post.admin.inc \_social_post_mass_update_batch_finished()
  9. 10.1.x modules/social_features/social_post/social_post.admin.inc \_social_post_mass_update_batch_finished()
  10. 10.2.x modules/social_features/social_post/social_post.admin.inc \_social_post_mass_update_batch_finished()

Implements callback_batch_finished().

Reports the 'finished' status of batch operation for social_post_mass_update().

Parameters

bool $success: A boolean indicating whether the batch mass update operation successfully concluded.

string[] $results: An array of rendered links to posts updated via the batch mode process.

array $operations: An array of function calls (not used in this function).

See also

_social_post_mass_update_batch_process()

1 string reference to '_social_post_mass_update_batch_finished'
social_post_mass_update in modules/social_features/social_post/social_post.admin.inc
Updates all posts in the passed-in array with the passed-in field values.

File

modules/social_features/social_post/social_post.admin.inc, line 160
Helper methods for post administration actions.

Code

function _social_post_mass_update_batch_finished($success, array $results, array $operations) {
  if ($success) {
    \Drupal::messenger()
      ->addStatus(t('The update has been performed.'));
  }
  else {
    \Drupal::messenger()
      ->addError(t('An error occurred and processing did not complete.'));
    $message = \Drupal::translation()
      ->formatPlural(count($results), '1 item successfully processed:', '@count items successfully processed:');
    $item_list = [
      '#theme' => 'item_list',
      '#items' => $results,
    ];
    $message .= \Drupal::service('renderer')
      ->render($item_list);
    \Drupal::messenger()
      ->addStatus($message);
  }
}