You are here

public static function EmailVerifyBatch::finishBatch in Email Verify 8.2

File

src/EmailVerifyBatch.php, line 84

Class

EmailVerifyBatch

Namespace

Drupal\email_verify

Code

public static function finishBatch($success, $results, $operations) {
  if ($success) {
    if (!empty($results['errors'])) {
      foreach ($results['errors'] as $error) {
        drupal_set_message($error, 'error');

        //\Drupal::logger('config_sync')->error($error);
      }
      drupal_set_message(\Drupal::translation()
        ->translate('The configuration was imported with errors.'), 'warning');
    }
    else {
      drupal_set_message(\Drupal::translation()
        ->translate('The configuration was imported successfully.'));
    }
  }
  else {

    // An error occurred.
    // $operations contains the operations that remained unprocessed.
    $error_operation = reset($operations);
    $message = \Drupal::translation()
      ->translate('An error occurred while processing %error_operation with arguments: @arguments', array(
      '%error_operation' => $error_operation[0],
      '@arguments' => print_r($error_operation[1], TRUE),
    ));
    drupal_set_message($message, 'error');
  }
}