You are here

public function VoteResultManager::getResults in Fivestar 8

Get all votes results for passed entity.

Parameters

\Drupal\Core\Entity\FieldableEntityInterface $entity:

Return value

array

1 call to VoteResultManager::getResults()
VoteResultManager::getResultsByVoteType in src/VoteResultManager.php
Get votes for passed entity based on vote type.

File

src/VoteResultManager.php, line 54

Class

VoteResultManager
Contains methods for managing vote results.

Namespace

Drupal\fivestar

Code

public function getResults(FieldableEntityInterface $entity) {
  $results = $this->voteResultManager
    ->getResults($entity
    ->getEntityTypeId(), $entity
    ->id());
  return !empty($results) ? $results : $this
    ->getDefaultResults();
}