You are here

function page_manager_get_page_cache in Chaos Tool Suite (ctools) 6

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

Get the cached changes to a given task handler.

12 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_context_cache_get in page_manager/page_manager.module
page_manager_context_cache_set in page_manager/page_manager.module
page_manager_edit_page_finish in page_manager/page_manager.admin.inc
Callback generated when the an operation edit finished.
page_manager_page_add_subtask in page_manager/plugins/tasks/page.admin.inc
Page callback to add a subtask.

... See full list

File

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

Code

function page_manager_get_page_cache($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;
  }
  return $cache;
}