You are here

public static function ViewsBulkOperationsAdvancedTestAction::finished in Views Bulk Operations (VBO) 4.0.x

Same name and namespace in other branches
  1. 8.3 tests/views_bulk_operations_test/src/Plugin/Action/ViewsBulkOperationsAdvancedTestAction.php \Drupal\views_bulk_operations_test\Plugin\Action\ViewsBulkOperationsAdvancedTestAction::finished()

Batch finished callback.

Parameters

bool $success: Was the process successful?

array $results: Batch process results array.

array $operations: Performed operations array.

Overrides ViewsBulkOperationsActionCompletedTrait::finished

File

tests/views_bulk_operations_test/src/Plugin/Action/ViewsBulkOperationsAdvancedTestAction.php, line 104

Class

ViewsBulkOperationsAdvancedTestAction
Action for test purposes only.

Namespace

Drupal\views_bulk_operations_test\Plugin\Action

Code

public static function finished($success, array $results, array $operations) : ?RedirectResponse {

  // Let's return a bit different message. We don't except faliures
  // in tests as well so no need to check for a success.
  $operations = array_count_values($results['operations']);
  $details = [];
  foreach ($operations as $op => $count) {
    $details[] = $op . ' (' . $count . ')';
  }
  $message = static::translate('Custom processing message: @operations.', [
    '@operations' => implode(', ', $details),
  ]);
  static::message($message);
  return NULL;
}