function votingapi_reaction_entity_delete in Voting API Reaction 8
Implements hook_entity_delete().
File
- ./
votingapi_reaction.module, line 175 - Allows users to react to any entity using Voting and Field APIs.
Code
function votingapi_reaction_entity_delete(EntityInterface $entity) {
if ($entity
->getEntityTypeId() == 'vote_type' && $entity
->getThirdPartySetting('votingapi_reaction', 'reaction')) {
// Delete icon along with the vote type.
$icon = $entity
->getThirdPartySetting('votingapi_reaction', 'icon');
if ($file = File::load($icon)) {
$file
->delete();
}
}
}