function UpAndDown::alterTemplateVars in Vote Up/Down 8        
                          
                  
                        
File
 
   - src/Plugin/VoteUpDownWidget/UpAndDown.php, line 20
 
  
  Class
  
  - UpAndDown 
 
  - Provides the "upanddown" Vote Up/Down widget
 
  Namespace
  Drupal\vud\Plugin\VoteUpDownWidget
Code
function alterTemplateVars($widget_template, &$variables) {
  $criteria = [
    'entity_type' => $variables['entity_type'],
    'entity_id' => $variables['entity_id'],
    'value_type' => $variables['points'],
    'tag' => $variables['tag'],
  ];
  $criteria['function'] = 'positives';
  $vote_result = votingapi_select_single_result_value($criteria);
  $variables['up_points'] = $vote_result;
  $criteria['function'] = 'negatives';
  $vote_result = votingapi_select_single_result_value($criteria);
  $variables['down_points'] = $vote_result;
}