You are here

public function RateWidget::vote in Rate 7.2

Save a vote.

Parameters

int $value:

1 call to RateWidget::vote()
RateWidget::processVote in classes/widget.inc
Process the users vote (if applicable).

File

classes/widget.inc, line 315

Class

RateWidget

Code

public function vote($value) {
  $votes = array(
    'entity_type' => $this->entity_type,
    'entity_id' => $this->entity_id,
    'value_type' => $this->value_type,
    'value' => $value,
    'tag' => $this->tag,
  );
  $criteria = NULL;

  // Call hook_rate_vote_alter().
  $redirect = FALSE;
  $save = TRUE;
  $context = array(
    'redirect' => &$redirect,
    'save' => &$save,
    'criteria' => &$criteria,
    'widget' => &$this,
  );
  drupal_alter('rate_vote', $votes, $context);
  if ($save) {
    votingapi_set_votes($votes, $criteria);
  }
}