You are here

public static function BynderConfigurationForm::batchFinished in Bynder 8.2

Same name and namespace in other branches
  1. 8.3 src/Form/BynderConfigurationForm.php \Drupal\bynder\Form\BynderConfigurationForm::batchFinished()
  2. 4.0.x src/Form/BynderConfigurationForm.php \Drupal\bynder\Form\BynderConfigurationForm::batchFinished()

Finish callback for the batch processing.

Parameters

bool $success: Whether the batch completed successfully.

array $results: The results array.

array $operations: The operations array.

File

src/Form/BynderConfigurationForm.php, line 550

Class

BynderConfigurationForm
Configure bynder to enable OAuth based access.

Namespace

Drupal\bynder\Form

Code

public static function batchFinished($success, array $results, array $operations) {
  $messenger = \Drupal::messenger();
  if (!empty($results)) {
    $messenger
      ->addStatus(t('Updated local metadata for @count media entities.', [
      '@count' => $results['updated'],
    ]));
    if ($results['skipped']) {
      $messenger
        ->addWarning(t('Failed to update the local metadata for @count media entities missing in the remote system.', [
        '@count' => $results['skipped'],
      ]));
    }
  }
  else {
    $messenger
      ->addWarning(t('There is an error with the connection to the Bynder service or there are no Bynder media entities to update.'));
  }
}