function Language::evaluate

Same name in other branches
  1. 9 core/modules/language/src/Plugin/Condition/Language.php \Drupal\language\Plugin\Condition\Language::evaluate()
  2. 10 core/modules/language/src/Plugin/Condition/Language.php \Drupal\language\Plugin\Condition\Language::evaluate()
  3. 11.x core/modules/language/src/Plugin/Condition/Language.php \Drupal\language\Plugin\Condition\Language::evaluate()

Overrides ConditionInterface::evaluate

File

core/modules/language/src/Plugin/Condition/Language.php, line 133

Class

Language
Provides a 'Language' condition.

Namespace

Drupal\language\Plugin\Condition

Code

public function evaluate() {
    if (empty($this->configuration['langcodes']) && !$this->isNegated()) {
        return TRUE;
    }
    $language = $this->getContextValue('language');
    // Language visibility settings.
    return !empty($this->configuration['langcodes'][$language->getId()]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.