You are here

function page_manager_handler_add_to_page in Chaos Tool Suite (ctools) 6

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

Import a handler into a page.

This is used by both import and clone, since clone just exports the handler and immediately imports it.

5 calls to page_manager_handler_add_to_page()
page_manager_handler_add_finish in page_manager/page_manager.admin.inc
Finish the add process and make the new handler official.
page_manager_handler_clone_submit in page_manager/page_manager.admin.inc
Clone an existing task handler into a new handler.
page_manager_handler_import_submit in page_manager/page_manager.admin.inc
Clone an existing task handler into a new handler.
page_manager_page_form_basic_submit in page_manager/plugins/tasks/page.admin.inc
Store the values from the basic settings form.
page_manager_page_new_page_cache in page_manager/plugins/tasks/page.inc
When adding or cloning a new page, this creates a new page cache and adds our page to it.

File

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

Code

function page_manager_handler_add_to_page(&$page, &$handler, $title = NULL) {
  $last = end($page->handler_info);
  $handler->weight = $last ? $last['weight'] + 1 : 0;
  $handler->task = $page->task_id;
  $handler->subtask = $page->subtask_id;
  $handler->export_type = EXPORT_IN_DATABASE;
  $handler->type = t('Normal');
  if ($title) {
    $handler->conf['title'] = $title;
  }
  $name = page_manager_handler_get_name($page->task_name, $page->handlers, $handler);
  $handler->name = $name;
  $page->handlers[$name] = $handler;
  $page->handler_info[$name] = array(
    'weight' => $handler->weight,
    'name' => $handler->name,
    'changed' => PAGE_MANAGER_CHANGED_CACHED,
  );
}