You are here

function context_ctools_render_alter in Context 7.3

Same name and namespace in other branches
  1. 6.3 context.core.inc \context_ctools_render_alter()
  2. 6.2 context.core.inc \context_ctools_render_alter()

Implementation of hook_ctools_render_alter(). Used to detect the presence of a page manager node view or node form.

File

./context.core.inc, line 95

Code

function context_ctools_render_alter($info, $page, $data) {
  extract($data);

  // 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');
          break;
        }
      }
    }
    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)) {
          if ($plugin = context_get_plugin('condition', 'taxonomy_term')) {
            $plugin
              ->execute($ctools_context->data, $task['name'] === 'term_view' ? 'view' : 'form');
          }
          break;
        }
      }
    }
  }
}