[development] module_exists vs. functions_exists?

Earnie Boyd earnie at users.sourceforge.net
Wed Jun 25 13:54:25 UTC 2008

Quoting Chris Johnson <cxjohnson at gmail.com>:

> module_invoke() is used to call core API functions in a special core API
> class called hooks.  If your function is not part of the core API, then
> using module_invoke to call it is misleading.  Misleading code is a
> maintenance problem.  Some day, the functionality of module_invoke() may
> change and not work correctly to call random contributed module functions.
> It will always work to call hooks, however.  Hence, by definition, it is
> wrong to use it for a purpose it was not meant.

Correct, and stating it like Chris has said we can go as far to say 
that module_invoke is a private core function reserved for the use of 
the hooks class.  Modules themselves should not use it unless the 
module has created a hook and needs to call other modules 
implementations of that hook.

Earnie -- http://for-my-kids.com/
-- http://give-me-an-offer.com/

More information about the development mailing list