1

I've declared a [module-name]_tokens() hook but when I output the contents of module_implements('tokens'), only my module appears in the list. I know that there are many more modules that implement hook_menu(); why do I get only my module listed? Where shall I look for possible errors?

4
  • There are 8 modules that implement it api.drupal.org/api/drupal/modules%21system%21system.api.php/… Commented Oct 15, 2012 at 13:21
  • I know, but why do I get only my module listed?
    – linkyndy
    Commented Oct 15, 2012 at 13:30
  • It returns perfectly for me, try clearing your cache Commented Oct 15, 2012 at 13:32
  • Tried that. Only if I call module_implements($hook, $sort = FALSE, $reset = FALSE) with the last parameter set to false and immediately call module_implements('tokens'), then the list is complete. Otherwise, it lists just my module. I cannot explain why.
    – linkyndy
    Commented Oct 15, 2012 at 13:36

1 Answer 1

0
$hooks = module_implements('tokens');
print_r($hooks);

It returns the follwoing

Array ( [0] => token [1] => date [2] => domain [3] => entity_token [4] => facetapi [5] => logintoboggan [6] => name [7] => node [8] => scheduler [9] => system [10] => taxonomy [11] => token_custom [12] => user [13] => views [14] => field [15] => menu )

The only place which i see is it is cached, try clearing the cache or try the following

 module_implements('tokens', FALSE, TRUE)

The third params is reset to reset the cache.

3
  • Tried that. Only if I call module_implements($hook, $sort = FALSE, $reset = FALSE) with the last parameter set to false and immediately call module_implements('tokens'), then the list is complete. Otherwise, it lists just my module. I cannot explain why.
    – linkyndy
    Commented Oct 15, 2012 at 13:37
  • If you have tried the same in a separate file and got the same result, Then i am sorry i do not have much idea in it. Commented Oct 15, 2012 at 13:42
  • Unfortunately, it doesn't work :(
    – linkyndy
    Commented Oct 15, 2012 at 15:20

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.