public function LanguageSelectionPageConditionMethodIsValid::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/ LanguageSelectionPageConditionMethodIsValid.php, line 77
Class
- LanguageSelectionPageConditionMethodIsValid
- Class for LanguageSelectionPageConditionMethodIsValid.
Namespace
Drupal\language_selection_page\Plugin\LanguageSelectionPageConditionCode
public function evaluate() {
$this->languageNegotiator
->setCurrentUser($this->currentUser);
$methods = $this->languageNegotiator
->getNegotiationMethods(LanguageInterface::TYPE_INTERFACE);
if (!isset($methods[LanguageNegotiationLanguageSelectionPage::METHOD_ID])) {
return $this
->block();
}
return $this
->pass();
}