public function VotingApiReactionManager::getResults in Voting API Reaction 8
Return voting results for each active reaction.
Parameters
\Drupal\votingapi\Entity\Vote $entity: Current vote entity.
array $settings: Field settings.
Return value
array Array containing Voting API voting results.
File
- src/
VotingApiReactionManager.php, line 163
Class
- VotingApiReactionManager
- Manages reactions through Voting API entities.
Namespace
Drupal\votingapi_reactionCode
public function getResults(Vote $entity, array $settings) {
// Get results for each reaction.
$results = $this->votingApiResults
->getResults($entity
->getVotedEntityType(), $entity
->getVotedEntityId());
$reactions = array_filter($settings['reactions']);
return array_intersect_key($results, $reactions);
}