You are here

public function LanguageSelectionPageConditionLanguagePrefixes::evaluate in Language Selection Page 8.2

Evaluates the condition and returns TRUE or FALSE accordingly.

Return value

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

Overrides LanguageSelectionPageConditionBase::evaluate

File

src/Plugin/LanguageSelectionPageCondition/LanguageSelectionPageConditionLanguagePrefixes.php, line 137

Class

LanguageSelectionPageConditionLanguagePrefixes
Class for the Language Prefixes plugin.

Namespace

Drupal\language_selection_page\Plugin\LanguageSelectionPageCondition

Code

public function evaluate() {
  $languages = $this->languageManager
    ->getNativeLanguages();
  $language_negotiation_config = $this->configFactory
    ->get('language.negotiation')
    ->get('url');
  $prefixes = array_filter($language_negotiation_config['prefixes']);
  if (\count($languages) !== \count($prefixes)) {
    return $this
      ->block();
  }
  return $this
    ->pass();
}