1 views_plugin_exposed_form.inc views_plugin_exposed_form::render_exposed_form($block = FALSE)

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.

File

core/modules/views/plugins/views_plugin_exposed_form.inc, line 149
Definition of views_plugin_exposed_form.

Class

views_plugin_exposed_form
The base plugin to handle exposed filter forms.

Code

function render_exposed_form($block = FALSE) {
  // Deal with any exposed filters we may have, before building.
  $form_state = array(
    'view' => &$this->view,
    'display' => &$this->display,
    'method' => 'get',
    'rerender' => TRUE,
    'no_redirect' => TRUE,
    'always_process' => 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->view->display_handler->displays_exposed() || (!$block && $this->view->display_handler->get_option('exposed_block'))) {
    unset($form_state['rerender']);
  }

  if (!empty($this->ajax)) {
    $form_state['ajax'] = TRUE;
  }

  $form_state['exposed_form_plugin'] = $this;
  $form = backdrop_build_form('views_exposed_form', $form_state);
  $output = backdrop_render($form);

  if (!$this->view->display_handler->displays_exposed() || (!$block && $this->view->display_handler->get_option('exposed_block'))) {
    return "";
  }
  else {
    return $output;
  }
}