You are here

public function VoteController::undoVote in Rate 8

Undo a vote.

Parameters

string $entity_type_id: Entity type ID such as node.

int $entity_id: Entity id of the entity type.

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::undoVote'
rate.routing.yml in ./rate.routing.yml
rate.routing.yml

File

src/Controller/VoteController.php, line 204

Class

VoteController
Returns responses for Rate routes.

Namespace

Drupal\rate\Controller

Code

public function undoVote($entity_type_id, $entity_id, $widget_type, Request $request) {
  $entity = $this->entityTypeManager
    ->getStorage($entity_type_id)
    ->load($entity_id);
  $this->rateVote
    ->undoVote($entity_type_id, $entity_id, !$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);
}