You are here

protected function GoogleAnalyticsEventTracking::languageMatch in Google Analytics Event Tracking 8.2

Same name and namespace in other branches
  1. 8 src/GoogleAnalyticsEventTracking.php \Drupal\google_analytics_et\GoogleAnalyticsEventTracking::languageMatch()

Evaluates whether the tracker is effective for current interface language.

Parameters

\Drupal\google_analytics_et\Entity\GoogleAnalyticsEventTrackerInterface $tracker:

Return value

bool

1 call to GoogleAnalyticsEventTracking::languageMatch()
GoogleAnalyticsEventTracking::isTrackerActive in src/GoogleAnalyticsEventTracking.php
Evaluates whether the provided event tracker is active in current context.

File

src/GoogleAnalyticsEventTracking.php, line 142

Class

GoogleAnalyticsEventTracking

Namespace

Drupal\google_analytics_et

Code

protected function languageMatch(GoogleAnalyticsEventTrackerInterface $tracker) {
  $languages = $tracker
    ->get('languages');
  if (empty($languages)) {
    return TRUE;
  }
  foreach ($languages as $id => $language) {
    if ($id == $this->languageManager
      ->getCurrentLanguage()
      ->getId()) {
      return TRUE;
    }
  }
  return FALSE;
}