function views_ui_preview_form

3.x admin.inc views_ui_preview_form($form, &$form_state, $view, $display_id = 'default')
2.x admin.inc views_ui_preview_form(&$form_state)

Form for generating argument information for the live preview.

2 string references to 'views_ui_preview_form'
template_preprocess_views_ui_edit_view in includes/admin.inc
Preprocess the view edit page.
views_ui_preview in includes/admin.inc
Page callback for the live preview.

File

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

Code

function views_ui_preview_form(&$form_state) {
  $view = &$form_state['view'];
  $view->init_display();
  $options = array();
  foreach ($view->display as $id => $display) {
    $options[$id] = $display->display_title;
  }

  $form['#attributes'] = array(
    'class' => 'clear-block',
  );

  $form['display_id'] = array(
    '#type' => 'select',
    '#title' => t('Display'),
    '#options' => $options,
    '#default_value' => $form_state['display_id'],
    '#id' => 'preview-display-id',
  );

  $form['args'] = array(
    '#type' => 'textfield',
    '#title' => t('Arguments'),
    '#default_value' => $form_state['view_args'],
    '#description' => t('Separate arguments with a / as though they were a URL path.'),
    '#id' => 'preview-args',
  );

  $form['preview'] = array(
    '#type' => 'submit',
    '#value' => t('Preview'),
    '#id' => 'preview-submit',
  );


  $form['live_preview'] = array(
    '#type' => 'checkbox',
    '#title' => t('Automatic live preview'),
    '#default_value' => !variable_get('views_ui_disable_live_preview', 0),
  );

  $form['#action'] = url("admin/build/views/nojs/preview/$view->name");
  return $form;
}