Extra Block Types (EBT) - New Layout Builder experience❗

Extra Block Types (EBT) - styled, customizable block types: Slideshows, Tabs, Cards, Accordions and many others. Built-in settings for background, DOM Box, javascript plugins. Experience the future of layout building today.

Demo EBT modules Download EBT modules

❗Extra Paragraph Types (EPT) - New Paragraphs experience

Extra Paragraph Types (EPT) - analogical paragraph based set of modules.

Demo EPT modules Download EPT modules

Scroll

3.5.2. Views exposed filters. Drupal: Ads board

23/08/2019, by mikhail

The Views module allows you to not only set a filter and display materials, but also allows you to change these filters dynamically. Let's create a small real estate bulletin board using the Views module.

In order to display ads, we first need to create an announcement content type. To do this, go to Structure - Content types - Add Content type:

drupal 8 ads

Now for our content type you need to add the fields: Number of rooms, price, address, phone, name. We go to the tab Manage fields of the content type Announcement:

drupal 8 view

For the number of rooms you need to select the type List (text):

drupal 8 fields

Next you need to set what types of apartments are:

drupal 8 fields

You also need to add a Price, for this, select the field type Number (integer). In the Settings for the Prices field, specify the prefix so that the name of the currency comes after the price:

drupal 8 field suffix

The fields address, telephone and name can be created with the type Text (plain).

Now that we have the fields, let's create a new view of the Announcement (Structure - Views — Add view):

drupal 8 views

Now let's add the Number of rooms filter and put this checkmark for exposed filters:

drupal 8 views

This will allow you to display this filter on the Announcement page:

drupal 8

Now if we choose any of the parameters, there will be only one type of apartment:

drupal 8

You can also add any other fields to the Announcement and display them as Exposed filters. Let's add the price to exposed filters as well.

drupal 8

When we set the Between operator, we allowed the user to set the price range that suits him.

In addition to exposed filters, we can also perform sorting, for example, by price, allowing users to select sorting in descending order of price or ascending order:

drupal 8

Now we have a filter for announcement, which really remains to be themed.

drupal 8