function context_get_plugin in Context 6.3
Same name and namespace in other branches
- 7.3 context.module \context_get_plugin()
Get a plugin handler.
19 calls to context_get_plugin()
- context_blocks in ./
context.core.inc - This override of theme_blocks() is called because of an alter of the theme registry. See context_theme_registry_alter().
- context_condition_map in ./
context.module - Loads an associative array of conditions => context identifiers to allow contexts to be set by different conditions.
- context_context_page_condition in ./
context.core.inc - Implementation of hook_context_page_condition().
- context_context_page_reaction in ./
context.core.inc - Implementation of hook_context_page_reaction().
- context_form_alter in ./
context.core.inc - Implementation of hook_form_alter().
File
- ./
context.module, line 447
Code
function context_get_plugin($type = 'condition', $key, $reset = FALSE) {
static $cache = array();
if (!isset($cache[$type][$key]) || $reset) {
switch ($type) {
case 'condition':
$registry = context_conditions();
break;
case 'reaction':
$registry = context_reactions();
break;
}
if (isset($registry[$key], $registry[$key]['plugin'])) {
ctools_include('plugins');
$info = $registry[$key];
$plugins = ctools_get_plugins('context', 'plugins');
if (isset($plugins[$info['plugin']]) && ($class = ctools_plugin_get_class($plugins[$info['plugin']], 'handler'))) {
$cache[$type][$key] = new $class($key, $info);
}
}
}
return isset($cache[$type][$key]) ? $cache[$type][$key] : FALSE;
}