You are here

function views_ui_edit_form_submit_duplicate_display in Views (for Drupal 7) 7.3

Submit handler to duplicate a display for a view.

1 string reference to 'views_ui_edit_form_submit_duplicate_display'
views_ui_get_display_tab_details in includes/admin.inc
Helper function to get the display details section of the edit UI.

File

includes/admin.inc, line 1364
Provides the Views' administrative interface.

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 edit page.
  $form_state['redirect'] = 'admin/structure/views/view/' . $view->name . '/edit/' . $new_display_id;
}