You are here

public static function UpdateTerms::updateAllTermsFinishedCallback in Termcase 8

Callback function to format number of results or error message.

File

src/UpdateTerms.php, line 54

Class

UpdateTerms
Class, which contains the callbacks of a batch process.

Namespace

Drupal\termcase

Code

public static function updateAllTermsFinishedCallback($success, $results, $operations) {

  // The 'success' parameter means no fatal PHP errors were detected. All
  // other error management should be handled using 'results'.
  if ($success) {
    $message = \Drupal::translation()
      ->formatPlural(count($results), 'One post processed.', '@count posts processed.');
  }
  else {
    $message = t('Finished with an error.');
  }
  \Drupal::messenger()
    ->addMessage($message);
}