You are here

function voting_rules_get_vote_results in Voting Rules 7

Rules callback to get vote results on an entity.

1 string reference to 'voting_rules_get_vote_results'
voting_rules_rules_data_info_alter in ./voting_rules.rules.inc
Implemnts hook_rules_data_info_alter().

File

./voting_rules.module, line 162
Voting Rules module.

Code

function voting_rules_get_vote_results($entity, array $options, $name, $entity_type) {
  $entity_key = voting_rules_get_entity_key($entity_type);
  $results = array();
  $select_results = votingapi_select_results(array(
    'entity_id' => $entity->{$entity_key},
    'entity_type' => $entity_type,
  ));
  foreach ($select_results as $select_result) {
    $results[$select_result['function']] = $select_result;
  }
  return $results;
}