1.20.x views.module views_form($form, &$form_state, $view, $output)

This is the entry function. Just gets the form for the current step. The form is always assumed to be multistep, even if it has only one step (the default 'views_form_views_form' step). That way it is actually possible for modules to have a multistep form if they need to.

File

modules/views/views.module, line 1501
Primarily Backdrop hooks and global API functions to manipulate views.

Code

function views_form($form, &$form_state, $view, $output) {
  $form_state['step'] = isset($form_state['step']) ? $form_state['step'] : 'views_form_views_form';
  // Cache the built form to prevent it from being rebuilt prior to validation
  // and submission, which could lead to data being processed incorrectly,
  // because the views rows (and thus, the form elements as well) have changed
  // in the meantime.
  $form_state['cache'] = TRUE;

  $form = array();
  $query = backdrop_get_query_parameters($_GET, array('q'));
  $form['#action'] = url($view->get_url(), array('query' => $query));
  // Tell the preprocessor whether it should hide the header, footer, pager...
  $form['show_view_elements'] = array(
    '#type' => 'value',
    '#value' => ($form_state['step'] == 'views_form_views_form') ? TRUE : FALSE,
  );

  $form = $form_state['step']($form, $form_state, $view, $output);
  return $form;
}