You are here

function panel_context_panels_cache_get in Panels 8.3

Same name and namespace in other branches
  1. 6.3 panels.module \panel_context_panels_cache_get()
  2. 7.3 panels.module \panel_context_panels_cache_get()

Get display edit cache on behalf of panel context.

The key is the second half of the key in this form: panel_context:TASK_NAME::HANDLER_NAME::args::url;

Related topics

File

./panels.module, line 1313
panels.module

Code

function panel_context_panels_cache_get($key) {
  ctools_include('common', 'panels');
  ctools_include('context');
  ctools_include('context-task-handler');

  // this loads the panel context inc even if we don't use the plugin.
  $plugin = page_manager_get_task_handler('panel_context');
  list($task_name, $handler_name, $args, $q) = explode('::', $key, 4);
  $page = page_manager_get_page_cache($task_name);
  if (isset($page->display_cache[$handler_name])) {
    return $page->display_cache[$handler_name];
  }
  if ($handler_name) {
    $handler =& $page->handlers[$handler_name];
  }
  else {
    $handler =& $page->new_handler;
  }
  $cache = new stdClass();
  $task = page_manager_get_task($page->task_id);

  //ctools_context_handler_get_all_contexts($page->task, $page->subtask, $handler);
  $arguments = array();
  if ($args) {
    $arguments = explode('\\', $args);
    $contexts = ctools_context_handler_get_task_contexts($task, $page->subtask, $arguments);
    $contexts = ctools_context_handler_get_handler_contexts($contexts, $handler);
  }
  else {
    $contexts = ctools_context_handler_get_all_contexts($page->task, $page->subtask, $handler);
  }
  $cache->display =& panels_panel_context_get_display($handler);
  $cache->display->context = $contexts;
  $cache->display->cache_key = 'panel_context:' . $key;
  $cache->content_types = panels_common_get_allowed_types('panels_page', $cache->display->context);
  $cache->display_title = TRUE;
  $cache->locked = $page->locked;
  return $cache;
}