Skip to content

Commit

Permalink
Check if action is appropriate for entity before executing
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasvanschaik committed Feb 17, 2023
1 parent 74755f8 commit 87f475d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/PresetReaction/PresetReaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ public function execute(EntityInterface $entity = NULL) {
$action_ids = $config['actions'];
foreach ($action_ids as $action_id) {
$action = $this->actionStorage->load($action_id);
$action->execute([$entity]);
// Make sure that the action is appropriate for the entity.
if ($entity->getEntityTypeId() === $action->getType()) {
$action->execute([$entity]);
}
}
}

Expand Down

0 comments on commit 87f475d

Please sign in to comment.