You are here

function panelizer_context_cache_get in Panelizer 6

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

Fetch the panelizer object from the object cache.

CTools clumsy context editing system requires caching. This lets us do it reasonably.

Parameters

$type: Can be something like 'node' or 'user' or 'default'.

$key: Depends on the $type. Can be a nid, a uid or a default key.

2 calls to panelizer_context_cache_get()
panelizer_default_context_page in includes/admin.inc
Page to configure what content is available for a given node type.
panelizer_edit_node_context_page in includes/node.inc
Page to edit basic settings on a panelized node.

File

./panelizer.module, line 523
panelizer.module

Code

function panelizer_context_cache_get($type, $key) {
  ctools_include('object-cache');
  $cache = ctools_object_cache_get('panelizer_context_cache', $type . ':' . $key);
  if (!empty($cache)) {
    $cache->cached = TRUE;
    return $cache;
  }
  switch ($type) {
    case 'default':
      $panelizer = panelizer_load_default_by_name($key);
      $panelizer->base_contexts = panelizer_get_base_context($panelizer->panelizer_type);
      return $panelizer;
    case 'node':
      ctools_include('node', 'panelizer');
      return panelizer_load_node_panelizer($key);
    case 'user':
  }
}