public function LanguageCookieConditionMethodIsValid::evaluate in Language Cookie 8
Evaluates the condition and returns TRUE or FALSE accordingly.
Return value
bool TRUE if the condition has been met, FALSE otherwise.
Overrides LanguageCookieConditionBase::evaluate
File
- src/
Plugin/ LanguageCookieCondition/ LanguageCookieConditionMethodIsValid.php, line 74
Class
- LanguageCookieConditionMethodIsValid
- Class for LanguageCookieConditionPathIsValid.
Namespace
Drupal\language_cookie\Plugin\LanguageCookieConditionCode
public function evaluate() {
$user = $this->currentUser;
$this->languageNegotiator
->setCurrentUser($user);
$methods = $this->languageNegotiator
->getNegotiationMethods(LanguageInterface::TYPE_INTERFACE);
// Do not set cookie if not configured in Language Negotiation.
if (!isset($methods[LanguageNegotiationCookie::METHOD_ID])) {
return $this
->block();
}
return $this
->pass();
}