[development] module_exists vs. functions_exists?
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,
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the development