function 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 1456
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;
// Ensure the handler uuids are re-generated.
if ($handlers) {
foreach ($handlers as &$handler) {
if (isset($handler->conf['display']) && method_exists($handler->conf['display'], 'clone_display')) {
$handler->conf['display'] = $handler->conf['display']
->clone_display();
}
}
}
// 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);
}