5

I'm trying to show my views exposed filter as a block (so it's placeable in the block structure), from a block display. I understand if I was using a page display, I could just use "Advanced > Exposed Form" to show as block, but the option doesn't exist if the views' output is a block.

I've search everywhere, and I can't find any solution. Do you have any idea?

8

In Drupal 7+ ensure that in the "advanced settings->other" in your block view, Use ajax=YES.

  • Awesome! it just works. Great! – Capy Oct 26 '15 at 18:56
3

You can make this happen by following these steps:

  1. Create a view with a page display (e.g. myview)
  2. In Advanced settings, change the machine name of the display page (e.g. mypagedisplay)
  3. Choose "Exposed filter in block"
  4. Enable the PHP filter
  5. Create a block, and embed this code:

    <?php
      print views_embed_view("my view", "mypagedisplay");
    ?>
    
  6. Choose the PHP input format for the block

  • 1
    I can confirm this works, thanks you!!! I recommend using a small custom module for the block instead of a block with the php filter which is evil. – ipwa Oct 29 '12 at 14:49
2

There is also now a module views block filter block, that overrides the block views display type to allow having a block view with exposed filters in a block.

1

In drupal 8 the only way I could get this work was to have a Page view where I have selected "Expose filters as block" Then On the content type that I want to have the view as a block I use https://www.drupal.org/project/viewsreference and set it as a field I can then have the Page view in this reference field and have my exposed filters block in the sidebar of the page. This might not work for everyone's use case but hopefully helps some people :)

0

In views 7.x-3.5 does not have that options now (Exposed form in block ) but

This option is avaliable in the development version of views 7.x-3.x-dev and below.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.