function views_plugin_exposed_form::render_exposed_form

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

plugins/views_plugin_exposed_form.inc, line 146

Class

views_plugin_exposed_form
The base plugin to handle exposed filter forms.

Code

public 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 = drupal_build_form('views_exposed_form', $form_state);
    if (!$this->view->display_handler
        ->displays_exposed() || !$block && $this->view->display_handler
        ->get_option('exposed_block')) {
        return "";
    }
    else {
        return drupal_render($form);
    }
}