You are here

function panelizer_panels_cache_get in Panelizer 7

Same name and namespace in other branches
  1. 6 panelizer.module \panelizer_panels_cache_get()
  2. 7.3 panelizer.module \panelizer_panels_cache_get()
  3. 7.2 panelizer.module \panelizer_panels_cache_get()

Get display edit cache for a panel being edited.

The key is the second half of the key in this form: panelizer:TYPE:KEY;

File

./panelizer.module, line 577
panelize.module

Code

function panelizer_panels_cache_get($argument) {
  ctools_include('object-cache');
  list($type, $key) = explode(':', $argument, 2);
  $cache = ctools_object_cache_get('panelizer_display_cache', $type . ':' . $key);
  if (!empty($cache)) {
    $cache->cached = TRUE;
    switch ($type) {
      case 'default':
        $panelizer = panelizer_load_default_by_name($key);
        $cache->display->context = panelizer_get_contexts($panelizer);
        break;
      case 'node':
        ctools_include('node', 'panelizer');
        $panelizer = panelizer_load_node_panelizer($key);
        $node = node_load($key);
        $cache->display->context = panelizer_get_contexts($panelizer, $node);
        break;
      case 'user':
    }
    return $cache;
  }
  switch ($type) {
    case 'default':
      $panelizer = panelizer_load_default_by_name($key);
      $cache = new stdClass();
      ctools_include('common', 'panels');
      $cache->display = panelizer_load_display($panelizer);
      $cache->display->context = panelizer_get_contexts($panelizer);
      $cache->display->cache_key = "panelizer:{$type}:{$key}";
      $cache->content_types = panels_common_get_allowed_types('panelizer_node:' . $type, $cache->display->context);
      return $cache;
    case 'node':
      ctools_include('node', 'panelizer');
      $panelizer = panelizer_load_node_panelizer($key);
      $cache = new stdClass();
      ctools_include('common', 'panels');
      $cache->display = panelizer_load_display($panelizer);
      $node = node_load($key);
      $cache->display->context = panelizer_get_contexts($panelizer, $node);
      $cache->display->cache_key = "panelizer:{$type}:{$key}";
      $cache->content_types = panels_common_get_allowed_types('panelizer_node:' . $node->type, $cache->display->context);
      return $cache;
    case 'user':
  }
}