Browse Source

Check if action is appropriate for entity before executing

MNPALS-2.x
Lucas van Schaik 2 years ago committed by Rosie Le Faive
parent
commit
9f83322902
  1. 5
      src/PresetReaction/PresetReaction.php

5
src/PresetReaction/PresetReaction.php

@ -56,7 +56,10 @@ class PresetReaction extends ContextReactionPluginBase implements ContainerFacto
$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]);
}
}
}

Loading…
Cancel
Save