Views #6 : Exposed Filters, Caching, Other Settings (Drupal 8 Tutorial #9) (Article + Video)

Submitted by TheMain on Wed, 12/30/2015 - 02:17

How to expose filters to visitors so they can change them and overview of the 'Other' settings, like caching.

Exposed Filters

  • Edit the Content: Publishing status filter in the FILTER CRITERIA section and check the following:

  • Click Apply
  • Unpublish some items and you can see the filter in action:

Exposed Filters can also be blocks:

  • Go to Structure > Block layout and click Place block for the Sidebar first section:

Now the exposed filter is showing in the sidebar:

Check out Better Exposed Filters: for extra options.

Other Settings

Here are some notes for the OTHER settings:

  • Sometimes it's useful to change the Machine Name to something more descriptive if you are planning to use the view display in some other place.
  • Enable Ajax to use options like pagers, sorting and exposed filters without page refresh.
  • Contextual link is the little pen picture you see when you hover over the view.
  • Aggregation can be used to group items together.
  • In the Query settings you could for example try to remove duplicates.

Especially when you have more complicated views with relationships, you might get duplicates. Check Views Distinct module in Drupal 7: "How To Remove Views Duplicates":

For individual fields you can use STYLE SETTINGS to add CSS classes. Check this on how to use tokens to do it in Drupal 7:

Posted by Samuli Natri on 30 December 2015