You are here

public static function FieldEncryptUpdateForm::finishBatch in Field Encryption 8.2

Finish batch encryption updates of fields.

Parameters

bool $success: A boolean indicating whether the batch has completed successfully.

array $results: The value set in $context['results'] by callback_batch_operation().

array $operations: If $success is FALSE, contains the operations that remained unprocessed.

File

src/Form/FieldEncryptUpdateForm.php, line 166

Class

FieldEncryptUpdateForm
Form builder for the field_encrypt field update page.

Namespace

Drupal\field_encrypt\Form

Code

public static function finishBatch($success, $results, $operations) {

  // The 'success' parameter means no fatal PHP errors were detected. All
  // other error management should be handled using 'results'.
  if ($success) {
    $message = \Drupal::translation()
      ->formatPlural(count($results['items']), 'One field updated.', '@count fields updated.');
    \Drupal::messenger()
      ->addMessage($message);
  }
  else {
    if (!empty($results['errors'])) {
      foreach ($results['errors'] as $error) {
        \Drupal::messenger()
          ->addError($error);
      }
    }
  }
}