Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello, I am working in one of the project using Flag module.
I want to add custom event when user flag any content. I am trying to use hook_flag_flag but it is not working.
I have added following uses in the module file for the flag.
use Drupal\flag\FlagInterface;
use Drupal\flag\Event\FlagEvents;
use Drupal\flag\Event\FlaggingEvent;
Is there anything to add more?
Thanks in advance.
Comments
Comment #2
joachim CreditAttribution: joachim commentedIn what way is it not working?
Have you checked it still exists? A lot of hooks were removed in the development process of the D8 version.
(BTW please don't use the tags field to duplicate other information. There's no point in doing that at all.)
Comment #3
Anks CreditAttribution: Anks commentedHello Joachim,
Thanks for the message.
Yes, I have checked that hook_flag changed to hook_flag_flag in D8. (https://www.drupal.org/node/1734814)
This is the code I am using in a module file.
But it is giving no output , Not even single error in errorlog.
Can you please help me for this issue.
Thanks.
Comment #4
joachim CreditAttribution: joachim commentedThat change record is for the 7.x-3.x branch. I do think it may have been removed completely for D8.
Comment #5
Anks CreditAttribution: Anks commentedAlright. I should go with some customized solution.
Thank you so much for quick response.
Comment #6
LOBsTerr CreditAttribution: LOBsTerr commentedI think you also use https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21...