You are here

public function LanguageCookieConditionXMLHTTPRequest::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/LanguageCookieConditionXMLHTTPRequest.php, line 59

Class

LanguageCookieConditionXMLHTTPRequest
Class for LanguageCookieConditionXMLHTTPRequest.

Namespace

Drupal\language_cookie\Plugin\LanguageCookieCondition

Code

public function evaluate() {
  if ($this->requestStack
    ->getCurrentRequest()
    ->isXmlHttpRequest()) {
    return $this
      ->block();
  }
  return $this
    ->pass();
}