public function VoteController::vote in Rate 8
Record a vote.
Parameters
string $entity_type_id: Entity type ID such as node.
int $entity_id: Entity id of the entity type.
string $vote_type_id: Vote type id.
int $value: The vote.
string $widget_type: Widget type.
\Symfony\Component\HttpFoundation\Request $request: Request object that contains redirect path.
Return value
\Symfony\Component\HttpFoundation\Response The response object.
1 string reference to 'VoteController::vote'
File
- src/
Controller/ VoteController.php, line 182
Class
- VoteController
- Returns responses for Rate routes.
Namespace
Drupal\rate\ControllerCode
public function vote($entity_type_id, $entity_id, $vote_type_id, $value, $widget_type, Request $request) {
$entity = $this->entityTypeManager
->getStorage($entity_type_id)
->load($entity_id);
$this->rateVote
->vote($entity_type_id, $entity_id, $vote_type_id, $value, !$this->config
->get('use_ajax'));
$this
->invalidateCacheTags($entity_type_id, $entity_id, $entity
->bundle());
return $this
->prepareResponse($entity_type_id, $entity_id, $entity
->bundle(), $widget_type, $request);
}