Skip to main content
added 69 characters in body
Source Link
Pravin Ajaaz
  • 3.6k
  • 4
  • 19
  • 37

I need to check whether a hook is implemented in a module, so I chose module_hook function. In the documentation it states that the Return Value will be:

TRUE if the module is both installed and enabled, and the hook is implemented in that module.

Now, I named a callback function (not a hook) in my module as "my_module_abc()"

Note: my_module is the name of my module.

If I test this function in module_hook like below:

module_hook('my_module', 'abc');

It returns TRUE.

  1. I thought It would return TRUE only for registered hooks and not for any function callbacks. Does module_hook know the difference between a function and a hook?

  2. Is there any function like hook_information($hook) which returns information about a hook?

Is this right? Am I missing something?

I need to check whether a hook is implemented in a module, so I chose module_hook function. In the documentation it states that the Return Value will be:

TRUE if the module is both installed and enabled, and the hook is implemented in that module.

Now, I named a callback function (not a hook) in my module as "my_module_abc()"

Note: my_module is the name of my module.

If I test this function in module_hook like below:

module_hook('my_module', 'abc');

It returns TRUE.

  1. I thought It would return TRUE only for registered hooks and not for any function callbacks.

  2. Is there any function like hook_information($hook) which returns information about a hook?

Is this right? Am I missing something?

I need to check whether a hook is implemented in a module, so I chose module_hook function. In the documentation it states that the Return Value will be:

TRUE if the module is both installed and enabled, and the hook is implemented in that module.

Now, I named a callback function (not a hook) in my module as "my_module_abc()"

Note: my_module is the name of my module.

If I test this function in module_hook like below:

module_hook('my_module', 'abc');

It returns TRUE.

  1. I thought It would return TRUE only for registered hooks and not for any function callbacks. Does module_hook know the difference between a function and a hook?

  2. Is there any function like hook_information($hook) which returns information about a hook?

Is this right? Am I missing something?

Source Link
Pravin Ajaaz
  • 3.6k
  • 4
  • 19
  • 37

How does module_hook() function work?

I need to check whether a hook is implemented in a module, so I chose module_hook function. In the documentation it states that the Return Value will be:

TRUE if the module is both installed and enabled, and the hook is implemented in that module.

Now, I named a callback function (not a hook) in my module as "my_module_abc()"

Note: my_module is the name of my module.

If I test this function in module_hook like below:

module_hook('my_module', 'abc');

It returns TRUE.

  1. I thought It would return TRUE only for registered hooks and not for any function callbacks.

  2. Is there any function like hook_information($hook) which returns information about a hook?

Is this right? Am I missing something?