3

I am working on a module that needs to send push notification through FCM, I use Firebase Push Notification (FCM) for this purpose and it works well.

So what I need to do is to send a push notification when a node of specific content type is created, and it's solved through hook_entity_insert, but problem is that I have multiple languages on site, and it works only when the node is created the first time.

So my question is how to know when translation is created for the first time for a specific node?

For example:

  • node is created on English (in hook_entity_insert I check if the node belong to specific content type and call a function to send the notification to all users that have English as user language).
  • now when we add the translation for other languages, how I can know that it's the first time translation is created, and not updated one?

1 Answer 1

3

You can try using hook_entity_translation_insert and use a common logic with hook_entity_insert

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.