3 namespace Drupal\views\Plugin\Block;
4 use Drupal\Core\Cache\Cache;
7 * Provides a 'Views Exposed Filter' block.
10 * id = "views_exposed_filter_block",
11 * admin_label = @Translation("Views Exposed Filter Block"),
12 * deriver = "Drupal\views\Plugin\Derivative\ViewsExposedFilterBlock"
15 class ViewsExposedFilterBlock extends ViewsBlockBase {
20 public function getCacheContexts() {
21 $contexts = $this->view->display_handler->getCacheMetadata()->getCacheContexts();
22 return Cache::mergeContexts(parent::getCacheContexts(), $contexts);
28 public function build() {
29 $output = $this->view->display_handler->viewExposedFormBlocks();
31 // Before returning the block output, convert it to a renderable array with
33 $this->addContextualLinks($output, 'exposed_filter');