You are here

protected function AgreementHandler::hasAnonymousUserAgreed in Agreement 8.2

Same name and namespace in other branches
  1. 3.0.x src/AgreementHandler.php \Drupal\agreement\AgreementHandler::hasAnonymousUserAgreed()

Check the status of the anonymous user for a particular agreement.

Parameters

\Drupal\agreement\Entity\Agreement $agreement: The agreement to check if a user has agreed.

Return value

bool TRUE if the user account has agreed to this agreement.

1 call to AgreementHandler::hasAnonymousUserAgreed()
AgreementHandler::hasAgreed in src/AgreementHandler.php
Check the status of an user account for a particular agreement.

File

src/AgreementHandler.php, line 285

Class

AgreementHandler
Agreement handler provides methods for looking up agreements.

Namespace

Drupal\agreement

Code

protected function hasAnonymousUserAgreed(Agreement $agreement) {
  $agreementType = $agreement
    ->id();
  return $this->requestStack
    ->getCurrentRequest()->cookies
    ->has(static::ANON_AGREEMENT_COOKIE_PREFIX . $agreementType);
}