function BatchTestCallbacks::finished9

Same name and namespace in other branches
  1. main core/modules/system/tests/modules/batch_test/src/BatchTestCallbacks.php \Drupal\batch_test\BatchTestCallbacks::finished9()

Implements callback_batch_finished().

Triggers 'finished' callback for batch 9.

File

core/modules/system/tests/modules/batch_test/src/BatchTestCallbacks.php, line 294

Class

BatchTestCallbacks
Batch callbacks for testing batches.

Namespace

Drupal\batch_test

Code

public function finished9($success, $results, $operations, $elapsed) : void {
  // Use item list template to render the messages.
  $message = [
    '#type' => 'inline_template',
    '#template' => 'Finished Url: <span class="batch-finished-url">{{ finished_url }}</span><br/ >Batch URLs: {{ urls }}',
    '#context' => [
      'finished_url' => \Drupal::request()->getUri(),
      'urls' => [
        '#theme' => 'item_list',
        '#items' => $results,
        '#attributes' => [
          'class' => [
            'batch-urls',
          ],
        ],
      ],
    ],
  ];
  \Drupal::messenger()->addStatus(\Drupal::service('renderer')->renderInIsolation($message));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.