You are here

public function EntityLegalDocument::getAcceptances in Entity Legal 7

Same name and namespace in other branches
  1. 7.2 entity_legal.entity.inc \EntityLegalDocument::getAcceptances()

Get the acceptances for this entity legal document revision.

Parameters

bool|object $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.

1 call to EntityLegalDocument::getAcceptances()
EntityLegalDocument::userHasAgreed in ./entity_legal.entity.inc
Check if the given user has agreed to the current version of this document.

File

./entity_legal.entity.inc, line 283
Entity API main classes used by entity_legal module.

Class

EntityLegalDocument
Legal Document entity with revision support.

Code

public function getAcceptances($account = FALSE, $published = TRUE) {
  $acceptances = array();
  $versions = array();
  if ($published) {
    $versions[] = $this
      ->getPublishedVersion();
  }
  else {
    $versions = $this
      ->getAllVersions();
  }
  foreach ($versions as $version) {
    $acceptances += $version
      ->getAcceptances($account);
  }
  return $acceptances;
}