You are here

public function GoogleAnalyticsCounterMessageManager::notAuthenticatedMessage in Google Analytics Counter 8.3

Prints a warning message when not authenticated.

Parameters

$build:

Overrides GoogleAnalyticsCounterMessageManagerInterface::notAuthenticatedMessage

File

src/GoogleAnalyticsCounterMessageManager.php, line 97

Class

GoogleAnalyticsCounterMessageManager
Defines the Google Analytics Counter message manager.

Namespace

Drupal\google_analytics_counter

Code

public function notAuthenticatedMessage($build = []) {
  $t_arg = [
    ':href' => Url::fromRoute('google_analytics_counter.admin_auth_form', [], [
      'absolute' => TRUE,
    ])
      ->toString(),
    '@href' => 'Authentication',
  ];
  $this->messenger
    ->addWarning(t('Google Analytics have not been authenticated! Google Analytics Counter cannot fetch any new data. Please authenticate with Google from the <a href=:href>@href</a> page.', $t_arg));

  // Revoke Google authentication.
  $this
    ->revokeAuthenticationMessage($build);
}