You are here

function page_manager_page_form_clone_submit in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 page_manager/plugins/tasks/page.admin.inc \page_manager_page_form_clone_submit()

submit clone page form.

Load the page, change the name(s) to protect the innocent, and if requested, load all the task handlers so that they get saved properly too.

File

page_manager/plugins/tasks/page.admin.inc, line 1432
Administrative functions for the page subtasks.

Code

function page_manager_page_form_clone_submit(&$form, &$form_state) {
  $original = $form_state['page']->subtask['subtask'];
  $original->name = $form_state['values']['name'];
  $original->admin_title = $form_state['values']['admin_title'];
  $original->path = $form_state['values']['path'];
  $handlers = !empty($form_state['values']['handlers']) ? $form_state['page']->handlers : FALSE;

  // Export the handler, which is a fantastic way to clean database IDs out of it.
  $export = page_manager_page_export($original, $handlers);
  ob_start();
  eval($export);
  ob_end_clean();
  $task_name = page_manager_make_task_name('page', $page->name);
  $cache = new stdClass();
  page_manager_page_new_page_cache($page, $cache);
  page_manager_set_page_cache($cache);
  $form_state['redirect'] = page_manager_edit_url($task_name);
}