You are here

public static function BulkUpdateFields::bulkUpdateFieldsFinishedCallback in Bulk Update Fields 8

Same name and namespace in other branches
  1. 8.2 src/BulkUpdateFields.php \Drupal\bulk_update_fields\BulkUpdateFields::bulkUpdateFieldsFinishedCallback()

File

src/BulkUpdateFields.php, line 55

Class

BulkUpdateFields
BulkUpdateFields.

Namespace

Drupal\bulk_update_fields

Code

public static function bulkUpdateFieldsFinishedCallback($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_field = \Drupal::translation()
      ->formatPlural(count($results['results_fields']), 'One field processed', '@count fields processed');
    $message_entity = \Drupal::translation()
      ->formatPlural(count($results['results_entities']), 'One entity', '@count entities');
    $message = $message_field . ' on ' . $message_entity;
  }
  else {
    $message = t('Finished with an error.');
  }
  drupal_set_message($message);
}