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. 8.9.x core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::displayExposedForm()
  3. 10 core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::displayExposedForm()

Displays the Expose form.

Parameters

array $form: Associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

File

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

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.