You are here

public function HandlerBase::displayExposedForm in Drupal 9

Same name and namespace in other branches
  1. 8 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);
}