public function EntityLegalDocument::getAcceptances in Entity Legal 8.2
Same name and namespace in other branches
- 4.0.x src/Entity/EntityLegalDocument.php \Drupal\entity_legal\Entity\EntityLegalDocument::getAcceptances()
- 3.0.x src/Entity/EntityLegalDocument.php \Drupal\entity_legal\Entity\EntityLegalDocument::getAcceptances()
Get the acceptances for this entity legal document revision.
Parameters
\Drupal\Core\Session\AccountInterface|null $account: The Drupal user account to check for, or get all acceptances if FALSE.
bool $published: Get acceptances only for the currently published version.
Return value
array The acceptance entities keyed by acceptance id.
Overrides EntityLegalDocumentInterface::getAcceptances
1 call to EntityLegalDocument::getAcceptances()
- EntityLegalDocument::userHasAgreed in src/
Entity/ EntityLegalDocument.php - Check if the given user has agreed to the current version of this document.
File
- src/
Entity/ EntityLegalDocument.php, line 251
Class
- EntityLegalDocument
- Defines the entity legal document entity.
Namespace
Drupal\entity_legal\EntityCode
public function getAcceptances(AccountInterface $account = NULL, $published = TRUE) {
$acceptances = [];
$versions = [];
if ($published) {
$versions[] = $this
->getPublishedVersion();
}
else {
$versions = $this
->getAllVersions();
}
/** @var \Drupal\entity_legal\EntityLegalDocumentVersionInterface $version */
foreach ($versions as $version) {
$acceptances += $version
->getAcceptances($account);
}
return $acceptances;
}