function 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 469

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;
        $handler->conf['name'] = trim(preg_replace('/[^a-z0-9_]+/', '-', strtolower($title)), '-');
    }
    else {
        $handler->conf['name'] = '';
    }
    $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,
    );
}