You are here

public function Language::evaluate in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 139
Contains \Drupal\language\Plugin\Condition\Language.

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