function LocaleConfigBatch::batchFinished

Same name and namespace in other branches
  1. main core/modules/locale/src/LocaleConfigBatch.php \Drupal\locale\LocaleConfigBatch::batchFinished()

Implements callback_batch_finished().

Finishes callback of system page locale import batch.

Parameters

bool $success: Information about the success of the batch import.

array $results: Information about the results of the batch import.

See also

\Drupal\locale\LocaleConfigBatch::buildBatch()

File

core/modules/locale/src/LocaleConfigBatch.php, line 135

Class

LocaleConfigBatch
Provides the locale config update batch services.

Namespace

Drupal\locale

Code

public function batchFinished(bool $success, array $results) : void {
  if ($success) {
    $configuration = $results['stats']['config'] ?? 0;
    if ($configuration) {
      $this->messenger
        ->addStatus($this->t('The configuration was successfully updated. There are %number configuration objects updated.', [
        '%number' => $configuration,
      ]));
      ($this->logger)()
        ->notice('The configuration was successfully updated. %number configuration objects updated.', [
        '%number' => $configuration,
      ]);
    }
    else {
      $this->messenger
        ->addStatus($this->t('No configuration objects have been updated.'));
      ($this->logger)()
        ->notice('No configuration objects have been updated.');
    }
  }
}

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