Needs work
Project:
Context
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
9 Jan 2013 at 15:37 UTC
Updated:
4 Aug 2022 at 10:36 UTC
Jump to comment: Most recent
Hi there, there are a number of separate issues in the queue all based on the same theme. I'm attempting to reconcile that into a single issue here. Below is a code snippet that I had been using to resolve the issues, please review, and if this is satisfactory I could roll out a patch. thank you!
/**
* Implementation of hook_ctools_render_alter().
* Used to detect the presence of a page manager node, taxonomy or user view and form.
*/
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)) {
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');
break;
}
}
}
// Check for taxonomy term page handler
if ($page && 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');
$plugin->execute($ctools_context->data, $task['name'] === 'term_view' ? 'view' : 'form');
break;
}
}
}
// Check for user page handler
if ($page && in_array($task['name'], array('user_view', 'user_edit'), TRUE)) {
foreach ($contexts as $ctools_context) {
if (in_array('user', $ctools_context->type) && !empty($ctools_context->data)) {
$plugin = context_get_plugin('condition', 'user');
$plugin->execute($ctools_context->data, $task['name'] === 'user_view' ? 'view' : 'form');
break;
}
}
}
}
Comments
Comment #0.0
hazah commentedChanged
to <?phpComment #1
damienmckennaPlease provide a patch, thank you.