You are here

public function Language::summary in GoogleTagManager 8

Provides a human readable summary of the condition's configuration.

Overrides ConditionBase::summary

File

src/Plugin/Condition/Language.php, line 86

Class

Language
Provides a 'Language' condition.

Namespace

Drupal\google_tag\Plugin\Condition

Code

public function summary() {
  $languages = $this->languageManager
    ->getLanguages(LanguageInterface::STATE_ALL);
  $selected = $this->configuration['language_list'];

  // Reduce the language object list to a language name list.
  $this->values = array_reduce($languages, function (&$names, $language) use ($selected) {
    if (!empty($selected[$language
      ->getId()])) {
      $names[$language
        ->getId()] = $language
        ->getName();
    }
    return $names;
  }, []);
  return parent::summary();
}