public function AgreementHandler::isAnonymousAgreement in Agreement 8.2
Same name and namespace in other branches
- 3.0.x src/AgreementHandler.php \Drupal\agreement\AgreementHandler::isAnonymousAgreement()
Checks if we're processing an anonymous agreement.
Parameters
\Drupal\agreement\Entity\Agreement $agreement: The agreement to check for anonymous support.
\Drupal\Core\Session\AccountProxyInterface $account: The user account to check.
Return value
bool TRUE if the user is anonymous and the current agreement applies to anonymous users. Otherwise FALSE.
Overrides AgreementHandlerInterface::isAnonymousAgreement
2 calls to AgreementHandler::isAnonymousAgreement()
- AgreementHandler::agree in src/
AgreementHandler.php - Accept the agreement for an user account.
- AgreementHandler::hasAgreed in src/
AgreementHandler.php - Check the status of an user account for a particular agreement.
File
- src/
AgreementHandler.php, line 130
Class
- AgreementHandler
- Agreement handler provides methods for looking up agreements.
Namespace
Drupal\agreementCode
public function isAnonymousAgreement(Agreement $agreement, AccountProxyInterface $account) {
if ($account
->isAnonymous() && in_array(RoleInterface::ANONYMOUS_ID, $agreement
->getSettings()['roles'])) {
return TRUE;
}
return FALSE;
}