You are here

public function VotingApiReactionManager::rememberReaction in Voting API Reaction 8

Store reaction from session variable.

Parameters

\Drupal\votingapi\Entity\Vote $entity: Current vote entity.

File

src/VotingApiReactionManager.php, line 267

Class

VotingApiReactionManager
Manages reactions through Voting API entities.

Namespace

Drupal\votingapi_reaction

Code

public function rememberReaction(Vote $entity) {
  $_SESSION['votingapi_reaction'][implode(':', [
    $entity
      ->getVotedEntityId(),
    $entity
      ->getVotedEntityType(),
    $entity
      ->get('field_name')->value,
  ])] = $entity
    ->id();
}