You are here

public function SettingsForm::finishBatch in Opigno Moxtra 8

Same name and namespace in other branches
  1. 3.x src/Form/SettingsForm.php \Drupal\opigno_moxtra\Form\SettingsForm::finishBatch()

Finished callback of batch api.

Parameters

bool $success: Success or not.

array $results: The results.

array $operations: The operations.

File

src/Form/SettingsForm.php, line 351

Class

SettingsForm
Implements the Opigno Moxtra settings form.

Namespace

Drupal\opigno_moxtra\Form

Code

public function finishBatch(bool $success, array $results, array $operations) {
  if ($success) {
    $message = \Drupal::translation()
      ->formatPlural(count($results), 'One user processed.', '@count users processed.');
  }
  else {
    $message = $this
      ->t('Finished with an error.');
  }
  \Drupal::messenger()
    ->addMessage($message);
}