[development] module_exists vs. functions_exists?

Damien damz at prealable.org
Tue Jun 24 18:32:20 UTC 2008

On Tue, Jun 24, 2008 at 7:50 PM, Michael Prasuhn <mike at mikeyp.net> wrote,
about module_invoke():
> I don't buy it. This looks like an excellent use of an existing function
> that does exactly what is called for. What defines a 'hook' anyway? Is a
> function not a hook if only one module implements it? Would it be such a
> stretch to think of every function as a hook to be invoked in multiple
> different ways?

It doesn't make sense to use module_invoke() in the stated case (calling a
specific API function of a module). module_invoke() does not do any error
checking, and it does not report anything useful. You should call
drupal_functon_exists() directly and act accordingly in case of errors.

Using module_invoke() here would be bad practice at best, but could also be

Damien Tournoud
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20080624/5dc91f11/attachment-0001.htm 

More information about the development mailing list