You are here

function boost_ctools_render_alter in Boost 6

Implementation of hook_ctools_render_alter().

Needed to get the nodes that are inside of a panel's contex

File

./boost.module, line 234
Provides static file caching for Drupal text output. Pages, Feeds, ect...

Code

function boost_ctools_render_alter($info, $page, $args, $contexts, $task, $subtask, $handler) {

  // return if page not going to be cached or if database turned off
  if (!$GLOBALS['_boost_cache_this'] || BOOST_NO_DATABASE) {
    return;
  }
  foreach ($handler->conf['display']->context as $context) {
    if ($context->type == 'node') {
      $node = $context->data;

      // skip if node type is not set
      if (!isset($node->type)) {
        continue;
      }

      // set data
      $relationship = array(
        'child_page_callback' => 'node',
        'child_page_type' => $node->type,
        'child_page_id' => $node->nid,
      );
      if (BOOST_VERBOSE >= 9) {
        $relationship['debug'] = array(
          'panel-task' => $handler->task,
          'panel-subtask' => $handler->subtask,
          'node-path' => $node->path,
        );
      }

      // send to global
      $GLOBALS['_boost_relationships'][] = $relationship;
    }
  }
}