You are here

public function Language::evaluate in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/language/src/Plugin/Condition/Language.php \Drupal\language\Plugin\Condition\Language::evaluate()

Evaluates the condition and returns TRUE or FALSE accordingly.

Return value

bool TRUE if the condition has been met, FALSE otherwise.

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()]);
}