function ctools_plugin_process in Chaos Tool Suite (ctools) 6
Same name and namespace in other branches
- 7 includes/plugins.inc \ctools_plugin_process()
Process a single hook implementation of a ctools plugin.
Parameters
$info: The $info array about the plugin as returned by ctools_plugin_get_info()
$module: The module that implements the plugin being processed.
$identifier: The plugin identifier, which is used to create the name of the hook function being called.
$path: The path where files utilized by this plugin will be found.
$file: The file that was loaded for this plugin, if it exists.
$base: The base plugin name to use. If a file was loaded for the plugin, this is the plugin to assume must be present. This is used to automatically translate the array to make the syntax more friendly to plugin implementors.
2 calls to ctools_plugin_process()
- ctools_plugin_load_hooks in includes/
plugins.inc - Load plugin info for the provided hook; this is handled separately from plugins from files.
- ctools_plugin_load_includes in includes/
plugins.inc - Load plugins from a directory.
File
- includes/
plugins.inc, line 551 - 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_process($info, $module, $identifier, $path, $file = NULL, $base = NULL) {
if (is_array($identifier)) {
$result = $identifier;
}
else {
$function = $identifier . '_' . $info['hook'];
if (!function_exists($function)) {
return NULL;
}
$result = $function();
if (!isset($result) || !is_array($result)) {
return NULL;
}
}
// Automatically convert to the proper format that lets plugin implementations
// not nest arrays as deeply as they used to, but still support the older
// format where they do:
if ($base && (!isset($result[$base]) || !is_array($result[$base]))) {
$result = array(
$base => $result,
);
}
return _ctools_process_data($result, $info, $module, $path, $file);
}