You are here

public function DisplayPluginBase::usesExposed in Views (for Drupal 7) 8.3

Determine if this display uses exposed filters, so the view will know whether or not to build them.

5 calls to DisplayPluginBase::usesExposed()
Attachment::usesExposed in lib/Drupal/views/Plugin/views/display/Attachment.php
Attachment displays only use exposed widgets if they are set to inherit the exposed filter settings of their parent display.
Block::buildOptionsForm in lib/Views/block/Plugin/views/display/Block.php
Provide the default form for setting options.
Block::usesExposed in lib/Views/block/Plugin/views/display/Block.php
Block views use exposed widgets only if AJAX is set.
DisplayPluginBase::preExecute in lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
Set up any variables on the view prior to execution. These are separated from execute because they are extremely common and unlikely to be overridden on an individual display.
DisplayPluginBase::viewSpecialBlocks in lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
Render any special blocks provided for this display.
2 methods override DisplayPluginBase::usesExposed()
Attachment::usesExposed in lib/Drupal/views/Plugin/views/display/Attachment.php
Attachment displays only use exposed widgets if they are set to inherit the exposed filter settings of their parent display.
Block::usesExposed in lib/Views/block/Plugin/views/display/Block.php
Block views use exposed widgets only if AJAX is set.

File

lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php, line 191
Definition of Drupal\views\Plugin\views\display\DisplayPluginBase.

Class

DisplayPluginBase
The default display plugin handler. Display plugins handle options and basic mechanisms for different output methods.

Namespace

Drupal\views\Plugin\views\display

Code

public function usesExposed() {
  if (!isset($this->has_exposed)) {
    foreach ($this->handlers as $type => $value) {
      foreach ($this->view->{$type} as $id => $handler) {
        if ($handler
          ->canExpose() && $handler
          ->isExposed()) {

          // one is all we need; if we find it, return true.
          $this->has_exposed = TRUE;
          return TRUE;
        }
      }
    }
    $pager = $this
      ->getPlugin('pager');
    if (isset($pager) && $pager
      ->uses_exposed()) {
      $this->has_exposed = TRUE;
      return TRUE;
    }
    $this->has_exposed = FALSE;
  }
  return $this->has_exposed;
}