public function VoteController::voteAccess in Like & Dislike 8
Checks if the currentUser is allowed to vote.
Parameters
string $entity_type_id: The entity type ID.
string $vote_type_id: The vote type ID.
string $entity_id: The entity ID.
Return value
\Drupal\Core\Access\AccessResultInterface The access result.
1 string reference to 'VoteController::voteAccess'
File
- src/
Controller/ VoteController.php, line 136
Class
- VoteController
- Returns responses for Like & Dislikes routes.
Namespace
Drupal\like_and_dislike\ControllerCode
public function voteAccess($entity_type_id, $vote_type_id, $entity_id) {
$entity = $this
->entityTypeManager()
->getStorage($entity_type_id)
->load($entity_id);
// Check if user has permission to vote.
return AccessResult::allowedIf(like_and_dislike_can_vote($this
->currentUser(), $vote_type_id, $entity));
}