[development] module_exists vs. functions_exists?

Daniel F. Kudwien news at unleashedmind.com
Mon Jun 23 12:53:52 UTC 2008


> $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