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

Form callback; Clone a view.

File

core/modules/views_ui/views_ui.admin.inc, line 1913
Provides the Views' administrative interface.

Code

function views_ui_clone_form($form, &$form_state, view $view) {
  backdrop_set_title(t('Clone the view @name?', array('@name' => $view->get_human_name())));
  $form_state['view'] = $view;

  $form['label'] = array(
    '#type' => 'textfield',
    '#title' => t('View name'),
    '#required' => TRUE,
    '#size' => 32,
    '#maxlength' => 255,
    '#default_value' => t('Clone of @label', array('@label' => $view->get_human_name())),
  );
  $form['name'] = array(
    '#type' => 'machine_name',
    '#maxlength' => 128,
    '#machine_name' => array(
      'exists' => 'views_get_view',
      'source' => array('label'),
    ),
    '#default_value' => '',
    '#description' => t('A unique machine-readable name for this View. It must only contain lowercase letters, numbers, and underscores.'),
  );

  $form['actions'] = array('#type' => 'actions');
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Clone'),
  );

  return $form;
}