You are here

function views_ui::clone_page in Views (for Drupal 7) 7.3

Main entry point to clone an item.

Overrides ctools_export_ui::clone_page

1 call to views_ui::clone_page()
views_ui::add_template_page in plugins/export_ui/views_ui.class.php

File

plugins/export_ui/views_ui.class.php, line 366
Contains the CTools Export UI integration code.

Class

views_ui
CTools Export UI class handler for Views UI.

Code

function clone_page($js, $input, $item, $step = NULL) {
  $args = func_get_args();
  drupal_set_title($this
    ->get_page_title('clone', $item));
  $name = $item->{$this->plugin['export']['key']};
  $form_state = array(
    'plugin' => $this->plugin,
    'object' => &$this,
    'ajax' => $js,
    'item' => $item,
    'op' => 'add',
    'form type' => 'clone',
    'original name' => $name,
    'rerender' => TRUE,
    'no_redirect' => TRUE,
    'step' => $step,
    // Store these in case additional args are needed.
    'function args' => $args,
  );
  $output = drupal_build_form('views_ui_clone_form', $form_state);
  if (!empty($form_state['executed'])) {
    $item->name = $form_state['values']['name'];
    $item->human_name = $form_state['values']['human_name'];
    $item->vid = NULL;
    views_ui_cache_set($item);
    drupal_goto(ctools_export_ui_plugin_menu_path($this->plugin, 'edit', $item->name));
  }
  return $output;
}