Submit handler to clone a display as another display type.
public function submitCloneDisplayAsType($form, &$form_state) {
$view = $this->entity;
$display_id = $this->displayID;
// Create the new display.
$parents = $form_state['triggering_element']['#parents'];
$display_type = array_pop($parents);
$new_display_id = $view
->addDisplay($display_type);
$displays = $view
->get('display');
// Let the display title be generated by the addDisplay method and set the
// right display plugin, but keep the rest from the original display.
$display_clone = $displays[$display_id];
unset($display_clone['display_title']);
unset($display_clone['display_plugin']);
$displays[$new_display_id] = NestedArray::mergeDeep($displays[$new_display_id], $display_clone);
$displays[$new_display_id]['id'] = $new_display_id;
$view
->set('display', $displays);
// By setting the current display the changed marker will appear on the new
// display.
$view
->get('executable')->current_display = $new_display_id;
$view
->cacheSet();
// Redirect to the new display's edit page.
$form_state['redirect'] = 'admin/structure/views/view/' . $view
->id() . '/edit/' . $new_display_id;
}