function context_get_plugin in Context 7.3
Same name and namespace in other branches
- 6.3 context.module \context_get_plugin()
Get a plugin handler.
29 calls to context_get_plugin()
- context_admin_form_submit in ./
context.core.inc - Clear out block info cache when an admin area form is submitted.
- 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_ctools_render_alter in ./
context.core.inc - Implementation of hook_ctools_render_alter(). Used to detect the presence of a page manager node view or node form.
File
- ./
context.module, line 530
Code
function context_get_plugin($type, $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'))) {
// Check that class exists until CTools & registry issues are resolved.
if (class_exists($class)) {
$cache[$type][$key] = new $class($key, $info);
}
}
}
}
return isset($cache[$type][$key]) ? $cache[$type][$key] : FALSE;
}