I’m a total beginner in module coding and i’m trying to adapt a simple D7 module which is updating a field from a content type from an external API when the content is created or modified.
On an fresh D9 install, i’ve created a module named : edu_module
Created a folder /custom/edu_module in the module directory
Created a edu_module.info.yml
Activated the module => OK
and at last created an edu_module.module
file with this code :
use DrupalCoreEntityEntityInterface; function edu_module_entity_update(DrupalCoreEntityEntityInterface $entity) { Drupal::logger('edu_module')->alert('page updated by me'); Drupal::messenger()->addMessage('Page has been updtaed by me: ' . $entity->title->value); }
And nothing happen. I’ve tried two different way to obtain information (logger & messenger) but i have no results. I think hook is probably not fired but why not ? Can anyone help ?
Thanks for your help.