Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. HandlerBase.php

function 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);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal