- Issue created by @smurfxx
- 🇧🇪Belgium dieterholvoet Brussels
My guess is that adding messages doesn't work anymore at that point, because the post action hooks are executed in a shutdown function, at which point the page is already rendered.
I'm writing a custom module on Drupal 10 that needs your new hooks but I can't make it work.
My module's name is "custom_trigger_newsletter" and I added the dependency on custom_trigger_newsletter.info.yml:
name: 'Custom Trigger Newsletter'
type: module
description: 'custom module'
package: Custom
core_version_requirement: ^8 || ^9 || ^10
dependencies:
- hook_post_action:hook_post_action
In my custom_trigger_newsletter.module file I added this function:
function custom_trigger_newsletter_entity_postinsert(EntityInterface $entity, $op) {
\Drupal::messenger()->addMessage("action: $op - Entity: $entity->getType()");
}
Nothing happens, I followed your example module (that works correctly) but in my module, even after clearing caches aflter every change, nothing happens.
Can you help me please?
Active
1.2
Documentation
My guess is that adding messages doesn't work anymore at that point, because the post action hooks are executed in a shutdown function, at which point the page is already rendered.