You are here

public function AgreementHandler::hasAgreed in Agreement 3.0.x

Same name and namespace in other branches
  1. 8.2 src/AgreementHandler.php \Drupal\agreement\AgreementHandler::hasAgreed()

Check the status of an user account for a particular agreement.

Parameters

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

\Drupal\Core\Session\AccountProxyInterface $account: The user account to check.

Return value

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

Overrides AgreementHandlerInterface::hasAgreed

File

src/AgreementHandler.php, line 97

Class

AgreementHandler
Agreement handler provides methods for looking up agreements.

Namespace

Drupal\agreement

Code

public function hasAgreed(Agreement $agreement, AccountProxyInterface $account) {
  if ($this
    ->isAnonymousAgreement($agreement, $account)) {
    return $this
      ->hasAnonymousUserAgreed($agreement);
  }
  return $this
    ->hasAuthenticatedUserAgreed($agreement, $account);
}