function views_ui_clone_display_form_submit

Submit handler to add a clone to a display from a view.

1 string reference to 'views_ui_clone_display_form_submit'
views_ui_clone_display_form in includes/admin.inc
From to clone a display from a view.

File

includes/admin.inc, line 1928

Code

function views_ui_clone_display_form_submit($form, &$form_state) {
    // Create the new display
    $id = $form_state['display_id'];
    $display = $form_state['view']->display[$id];
    $new_id = $form_state['view']->add_display($display->display_plugin);
    $form_state['id'] = $new_id;
    // Replace the new display by a copy of the old
    $form_state['view']->display[$new_id] = drupal_clone($display);
    $form_state['view']->display[$new_id]->id = $new_id;
    // Store in cache
    views_ui_cache_set($form_state['view']);
    // Send it back
    $form_state['redirect'] = array(
        'admin/build/views/edit/' . $form_state['view']->name,
        NULL,
        'views-tab-' . $new_id,
    );
}