You are here

public static function GoogleAnalyticsReports::importFieldsFinished in Google Analytics Reports 8.3

Display messages after importing Google Analytics fields.

Parameters

bool $success: Indicates whether the batch process was successful.

array $results: Results information passed from the processing callback.

File

src/GoogleAnalyticsReports.php, line 167

Class

GoogleAnalyticsReports
GoogleAnalyticsReports service class.

Namespace

Drupal\google_analytics_reports

Code

public static function importFieldsFinished(bool $success, array $results) {
  if ($success) {
    \Drupal::messenger()
      ->addMessage(t('Imported @count Google Analytics fields.', [
      '@count' => count($results),
    ]));

    // Hook_views_data() doesn't see the GA fields before cleaning cache.
    drupal_flush_all_caches();
  }
  else {
    \Drupal::messenger()
      ->addMessage(t('An error has occurred during importing Google Analytics fields.'), 'error');
  }
}