You are here

function page_manager_get_page_cache in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 page_manager/page_manager.module \page_manager_get_page_cache()

Get the cached changes to a given task handler.

13 calls to page_manager_get_page_cache()
page_manager_cache_load in page_manager/page_manager.module
Menu callback to load a page manager cache object for menu callbacks.
page_manager_cache_page_manager_context_cache_finalize in page_manager/plugins/cache/page_manager_context.inc
Copy temporary data from the page manager cache.
page_manager_cache_page_manager_context_cache_get in page_manager/plugins/cache/page_manager_context.inc
page_manager_cache_page_manager_context_cache_set in page_manager/plugins/cache/page_manager_context.inc
page_manager_edit_page_finish in page_manager/page_manager.admin.inc
Callback generated when the an operation edit finished.

... See full list

File

page_manager/page_manager.module, line 299
The page manager module provides a UI and API to manage pages.

Code

function page_manager_get_page_cache($task_name) {
  $caches =& drupal_static(__FUNCTION__, array());
  if (!isset($caches[$task_name])) {
    ctools_include('object-cache');
    $cache = ctools_object_cache_get('page_manager_page', $task_name);
    if (!$cache) {
      $cache = new stdClass();
      $cache->task_name = $task_name;
      list($cache->task_id, $cache->subtask_id) = page_manager_get_task_id($cache->task_name);
      $cache->task = page_manager_get_task($cache->task_id);
      if (empty($cache->task)) {
        return FALSE;
      }
      if ($cache->subtask_id) {
        $cache->subtask = page_manager_get_task_subtask($cache->task, $cache->subtask_id);
        if (empty($cache->subtask)) {
          return FALSE;
        }
      }
      else {
        $cache->subtask = $cache->task;
        $cache->subtask['name'] = '';
      }
      $cache->handlers = page_manager_load_sorted_handlers($cache->task, $cache->subtask_id);
      $cache->handler_info = array();
      foreach ($cache->handlers as $id => $handler) {
        $cache->handler_info[$id] = array(
          'weight' => $handler->weight,
          'changed' => FALSE,
          'name' => $id,
        );
      }
    }
    else {

      // Ensure the task is loaded.
      page_manager_get_task($cache->task_id);
    }
    if ($task_name != '::new') {
      $cache->locked = ctools_object_cache_test('page_manager_page', $task_name);
    }
    else {
      $cache->locked = FALSE;
    }
    $caches[$task_name] = $cache;
  }
  return $caches[$task_name];
}