You are here

public static function BatchUpdateForm::batchFinished in Entity Usage 8.3

Same name and namespace in other branches
  1. 8 src/Form/BatchUpdateForm.php \Drupal\entity_usage\Form\BatchUpdateForm::batchFinished()

Finish callback for our batch processing.

Parameters

bool $success: Whether the batch completed successfully.

array $results: The results array.

array $operations: The operations array.

File

src/Form/BatchUpdateForm.php, line 210

Class

BatchUpdateForm
Form to launch batch tracking of existing entities.

Namespace

Drupal\entity_usage\Form

Code

public static function batchFinished($success, array $results, array $operations) {
  if ($success) {
    drupal_set_message(t('Recreated entity usage for @count entities.', [
      '@count' => count($results),
    ]));
    \Drupal::state()
      ->set('entity_usage_needs_regeneration', FALSE);
  }
  else {

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