function HandlerBase::displayExposedForm

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::displayExposedForm()
  2. 10 core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::displayExposedForm()
  3. 11.x core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::displayExposedForm()

Displays the Expose form.

File

core/modules/views/src/Plugin/views/HandlerBase.php, line 756

Class

HandlerBase
Base class for Views handler plugins.

Namespace

Drupal\views\Plugin\views

Code

public function displayExposedForm($form, FormStateInterface $form_state) {
    $item =& $this->options;
    // flip
    $item['exposed'] = empty($item['exposed']);
    // If necessary, set new defaults:
    if ($item['exposed']) {
        $this->defaultExposeOptions();
    }
    $view = $form_state->get('view');
    $display_id = $form_state->get('display_id');
    $type = $form_state->get('type');
    $id = $form_state->get('id');
    $view->getExecutable()
        ->setHandler($display_id, $type, $id, $item);
    $view->addFormToStack($form_state->get('form_key'), $display_id, $type, $id, TRUE, TRUE);
    $view->cacheSet();
    $form_state->set('rerender', TRUE);
    $form_state->setRebuild();
    $form_state->set('force_expose_options', TRUE);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.