You are here

function page_manager_handler_clone_submit in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 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 1602
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']);
  $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),
  );
}