You are here

function view::render_exposed_form in Views (for Drupal 7) 6.2

Render the exposed filter form.

This actually does more than that; because it's using FAPI, the form will also assign data to the appropriate handlers for use in building the query.

1 call to view::render_exposed_form()
view::build in includes/view.inc
Build the query for the view.

File

includes/view.inc, line 439
view.inc Provides the view object type and associated methods.

Class

view
An object to contain all of the data to generate a view, plus the member functions to build the view query, execute the query and render the output.

Code

function render_exposed_form($block = FALSE) {

  // Deal with any exposed filters we may have, before building.
  $form_state = array(
    'view' => &$this,
    'display' => &$this->display_handler->display,
    'method' => 'get',
    'rerender' => TRUE,
    'no_redirect' => TRUE,
  );

  // Some types of displays (eg. attachments) may wish to use the exposed
  // filters of their parent displays instead of showing an additional
  // exposed filter form for the attachment as well as that for the parent.
  if (!$this->display_handler
    ->displays_exposed() || !$block && $this->display_handler
    ->get_option('exposed_block')) {
    unset($form_state['rerender']);
  }
  if (!empty($this->ajax)) {
    $form_state['ajax'] = TRUE;
  }
  $output = drupal_build_form('views_exposed_form', $form_state);
  if (!empty($form_state['js settings'])) {
    $this->js_settings = $form_state['js settings'];
  }

  // Don't render exposed filter form when there's form errors.
  // Applies when filters are in a block ("exposed_block" option).
  if (form_get_errors() && empty($form_state['rerender'])) {
    return NULL;
  }
  return $output;
}