public function ExposedFormPluginBase::renderExposedForm

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

drupal/core/modules/views/lib/Drupal/views/Plugin/views/exposed_form/ExposedFormPluginBase.php, line 118
Definition of Drupal\views\Plugin\views\exposed_form\ExposedFormPluginBase.

Class

ExposedFormPluginBase
The base plugin to handle exposed filter forms.

Namespace

Drupal\views\Plugin\views\exposed_form

Code

public function renderExposedForm($block = FALSE) {

  // Deal with any exposed filters we may have, before building.
  $form_state = array(
    'view' => &$this->view,
    'display' => &$this->view->display_handler->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
    ->displaysExposed() || !$block && $this->view->display_handler
    ->getOption('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
    ->displaysExposed() || !$block && $this->view->display_handler
    ->getOption('exposed_block')) {
    return array();
  }
  else {
    return $form;
  }
}