You are here

function ctools_plugin_load_class in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 includes/plugins.inc \ctools_plugin_load_class()

Load a plugin and get a class name from it, returning success only if the class exists.

Parameters

$module: The module that owns the plugin type.

$type: The type of plugin.

$id: The id of the specific plugin to load.

$class_name: The identifier of the class. For example, 'handler'.

Return value

string The actual name of the class to call, or NULL if the class does not exist.

2 calls to ctools_plugin_load_class()
CtoolsPluginsGetInfoTestCase::assertPluginClass in tests/ctools.plugins.test
Assert helper to check that a plugin can be loaded using a named class.
CtoolsPluginsGetInfoTestCase::assertPluginMissingClass in tests/ctools.plugins.test
Assert helper to check that a plugin DOES NOT contain the named class.

File

includes/plugins.inc, line 904
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_load_class($module, $type, $id, $class_name) {
  $plugin = ctools_get_plugins($module, $type, $id);
  return ctools_plugin_get_class($plugin, $class_name);
}