You are here

function redirect_generate_batch_finished in Redirect 8

Same name and namespace in other branches
  1. 7.2 redirect.generate.inc \redirect_generate_batch_finished()
  2. 7 redirect.generate.inc \redirect_generate_batch_finished()
1 string reference to 'redirect_generate_batch_finished'
redirect_generate_redirects_batch_info in ./redirect.generate.inc

File

./redirect.generate.inc, line 168
Generate callbacks for the redirect module.

Code

function redirect_generate_batch_finished($success, $results, $operations) {
  if ($success) {
    \Drupal::messenger()
      ->addMessage(\Drupal::translation()
      ->formatPlural(count($results), 'One URL redirect created.', '@count URL redirects created.'));
  }
  else {

    // An error occurred.
    // $operations contains the operations that remained unprocessed.
    $error_operation = reset($operations);
    \Drupal::messenger()
      ->addMessage(t('An error occurred while processing @operation with arguments : @args', [
      '@operation' => $error_operation[0],
      '@args' => print_r($error_operation[0], TRUE),
    ]));
  }
}