diff --git a/context.core.inc b/context.core.inc index 17b9dd5..9e19831 100644 --- a/context.core.inc +++ b/context.core.inc @@ -94,8 +94,11 @@ function context_theme_registry_alter(&$theme_registry) { */ function context_ctools_render_alter($info, $page, $data) { extract($data); - // Check for node page handler - if ($page && in_array($task['name'], array('node_view', 'node_edit'), TRUE)) { + + // Check for page handlers. + if ($page) { + // Check for node page handler. + if (in_array($task['name'], array('node_view', 'node_edit'), TRUE)) { foreach ($contexts as $ctools_context) { if (in_array('node', $ctools_context->type) && !empty($ctools_context->data)) { context_node_condition($ctools_context->data, $task['name'] === 'node_view' ? 'view' : 'form'); @@ -103,17 +106,19 @@ function context_ctools_render_alter($info, $page, $data) { } } } - // Check for taxonomy term page handler - if ($page && in_array($task['name'], array('term_view', 'term_edit'), TRUE)) { + // Check for taxonomy term page handler. + elseif (in_array($task['name'], array('term_view', 'term_edit'), TRUE)) { foreach ($contexts as $ctools_context) { if (in_array('taxonomy_term', $ctools_context->type) && !empty($ctools_context->data)) { - $plugin = context_get_plugin('condition', 'taxonomy_term'); + if ($plugin = context_get_plugin('condition', 'taxonomy_term')) { $plugin->execute($ctools_context->data, $task['name'] === 'term_view' ? 'view' : 'form'); + } break; } } } } +} /** * Implementation of hook_entity_prepare_view().