0

I use the goalgorilla/open_social profile which brings in open social with its various modules. Inside its social_user.module there is a standard hook_form_FORM_ID_alter implementation which I temporarily edit and prepend echo 'social';. I also have a custom module my_custom_module with the same hook_form_FORM_ID_alter implementation which simply contains echo 'custom';.

My problem is that no matter what, I cannot get my custom module's echo to run after the open social's one. The higher weight of my custom module does not seem to affect anything. So far I've done the following:

  1. module_set_weight('my_custom_module', 9999);
  2. Confirmed in core.extension.yml that:
social: 0
social_user: 0
my_custom_module: 9999
  1. Installed https://www.drupal.org/project/modules_weight and confirmed the expected weights at admin/config/system/modules-weight.

Where should I look at next?

7
  • 1
    Does this answer your question? In what order are implementations of the of same hook done from different modules invoked?
    – leymannx
    Commented Sep 1, 2022 at 7:40
  • This didn't change from D7 to D8+. There's also an example in the docs: api.drupal.org/api/drupal/…
    – leymannx
    Commented Sep 1, 2022 at 7:40
  • @leymannx: No it does not. I am not asking about what the weight does or how to change it.
    – cherouvim
    Commented Sep 1, 2022 at 11:31
  • So you are not asking how to have your hook to be called after every other module's hook? What are you asking then? 🤔
    – leymannx
    Commented Sep 1, 2022 at 11:36
  • My problem is in the title. I know what the weight does, how to change it, and what effect it has. Yet in this case it doesn't seem to work.
    – cherouvim
    Commented Sep 1, 2022 at 12:00

2 Answers 2

1

You might want to read this issue. Didn't read it because there are most times better solutions by adding a callback to the form build which gets executed at the right time: #process, #after_build or #pre_render.

0

I faced the similar issue recently and figured out that some modules (like Field Group in my case) uses hook_module_implements_alter to change the order of execution.

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.