[development] module_exists vs. functions_exists?

Aaron Winborn winborn at advomatic.com
Mon Jun 23 14:59:23 UTC 2008


Ah, thanks. Keeping it simple...

----- Original Message -----
From: "Daniel F. Kudwien" <news at unleashedmind.com>
To: development at drupal.org
Sent: Monday, June 23, 2008 8:53:52 AM GMT -05:00 US/Canada Eastern
Subject: Re: [development] module_exists vs. functions_exists?

> $foo = module_invoke('module_name', 'api_function', $bar);

...without module_exists() is sufficient. module_invoke() invokes module_hook(), which in turn checks for function_exists().

Also, module_invoke() is not limited to Drupal hooks / API callbacks. If the returned results of call_user_func_array() work for your particular implementation, this is the best approach for each module that wants to integrate with another, optionally installed module in contrib.

@see http://api.drupal.org/api/function/module_invoke/5
@see http://api.drupal.org/api/function/module_hook/5

Daniel



More information about the development mailing list