1 views_ui.admin.inc views_ui_edit_form_submit_duplicate_display($form, &$form_state)

Submit handler to duplicate a display for a view.

File

core/modules/views_ui/views_ui.admin.inc, line 1358
Admin page callbacks for the Views UI module.

Code

function views_ui_edit_form_submit_duplicate_display($form, &$form_state) {
  $view = $form_state['view'];
  $display_id = $form_state['display_id'];

  // Create the new display.
  $display = $view->display[$display_id];
  $new_display_id = $view->add_display($display->display_plugin);
  $view->display[$new_display_id] = clone $display;
  $view->display[$new_display_id]->id = $new_display_id;

  // By setting the current display the changed marker will appear on the new
  // display.
  $view->current_display = $new_display_id;
  views_ui_cache_set($view);

  // Redirect to the new display's configure page.
  $form_state['redirect'] = 'admin/structure/views/view/' . $view->name . '/configure/' . $new_display_id;
}