You are here

public function VoteResultManager::getResultsByVoteType in Fivestar 8

Get votes for passed entity based on vote type.

Parameters

\Drupal\Core\Entity\FieldableEntityInterface $entity:

string $vote_type:

Return value

array

File

src/VoteResultManager.php, line 38

Class

VoteResultManager
Contains methods for managing vote results.

Namespace

Drupal\fivestar

Code

public function getResultsByVoteType(FieldableEntityInterface $entity, $vote_type) {
  $results = $this
    ->getResults($entity);
  if (isset($results[$vote_type])) {
    return $results[$vote_type];
  }
  return $this
    ->getDefaultResults();
}