You are here

function ctools_plugin_api_get_hook in Chaos Tool Suite (ctools) 7

Find out what hook to use to determine if modules support an API.

By default, most APIs will use hook_ctools_plugin_api, but some modules want sole ownership. This technique lets modules define what hook to use.

2 calls to ctools_plugin_api_get_hook()
bulk_export_export in bulk_export/bulk_export.module
FAPI gateway to the bulk exporter.
ctools_plugin_api_info in includes/plugins.inc
Get an array of information about modules that support an API.

File

includes/plugins.inc, line 180
Contains routines to organize and load plugins. It allows a special variation of the hook system so that plugins can be kept in separate .inc files, and can be either loaded all at once or loaded only when necessary.

Code

function ctools_plugin_api_get_hook($owner, $api) {

  // Allow modules to use their own hook for this. The only easy way to do
  // this right now is with a magically named function.
  if (function_exists($function = $owner . '_' . $api . '_hook_name')) {
    $hook = $function();
  }
  elseif (function_exists($function = $owner . '_ctools_plugin_api_hook_name')) {
    $hook = $function();
  }

  // Do this last so that if the $function above failed to return, we have a
  // sane default.
  if (empty($hook)) {
    $hook = 'ctools_plugin_api';
  }
  return $hook;
}