function page_manager_handler_clone_submit in Chaos Tool Suite (ctools) 7
Same name and namespace in other branches
- 6 page_manager/page_manager.admin.inc \page_manager_handler_clone_submit()
Clone an existing task handler into a new handler.
File
- page_manager/
page_manager.admin.inc, line 1683 - Administrative functions for the page manager.
Code
function page_manager_handler_clone_submit(&$form, &$form_state) {
$export = page_manager_export_task_handler($form_state['handler']);
ob_start();
eval($export);
ob_end_clean();
page_manager_handler_add_to_page($form_state['page'], $handler, $form_state['values']['title']);
// Variant is cloned and added to the Page. Ensure the uuids are re-generated.
panels_panel_context_get_display($handler);
if (isset($handler->conf['display']) && method_exists($handler->conf['display'], 'clone_display')) {
$handler->conf['display'] = $handler->conf['display']
->clone_display();
}
$plugin = page_manager_get_task_handler($handler->handler);
// It has no forms at all. Add the variant and go to its first operation.
$keys = array_keys($plugin['operations']);
$form_state['new trail'] = array(
'handlers',
$handler->name,
reset($keys),
);
}