public function DisplayPluginBase::viewExposedFormBlocks

Render the exposed form as block.

Return value

string|NULL The rendered exposed form as string or NULL otherwise.

File

drupal/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php, line 2712
Contains 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 viewExposedFormBlocks() {

  // avoid interfering with the admin forms.
  if (arg(0) == 'admin' && arg(1) == 'structure' && arg(2) == 'views') {
    return;
  }
  $this->view
    ->initHandlers();
  if ($this
    ->usesExposed() && $this
    ->getOption('exposed_block')) {
    $exposed_form = $this
      ->getPlugin('exposed_form');
    return $exposed_form
      ->renderExposedForm(TRUE);
  }
}