You are here

function votingapi_reaction_uninstall in Voting API Reaction 8

Implements hook_uninstall().

File

./votingapi_reaction.install, line 40
Contains voting_reactions.install.

Code

function votingapi_reaction_uninstall() {
  $reactions = _votingapi_reaction_get_reactions();
  $voteTypeStorage = \Drupal::service('entity_type.manager')
    ->getStorage('vote_type');

  // Remove reactions.
  $voteTypes = $voteTypeStorage
    ->loadMultiple($voteTypeStorage
    ->getQuery()
    ->condition('id', array_keys($reactions), 'IN')
    ->execute());
  foreach ($voteTypes as $voteType) {
    $voteType
      ->delete();
  }
}