Hi everyone,

I'm new to Drupal and on this forums. First, I would like to thank all the people behind this great CMS, contributors, module developpers... I'm discovering Drupal, it's a little bit complex to understand at first, but I'm really impressed by the quality of the work that has been done and the possibilities offered by Drupal.
OK, it's done, let's go to my question :)

Let's imagine we have a library referencing books, CDs and DVDs.

I have created 5 Content Types :
- Books
- CDs
- DVDs
-- Documents
--- Document Types (ex: presentation, press release, lyrics...)

As you imagine, we can create an entry for a DVD, attach Documents which have Document Types. All this is done with Entity Reference Fields.

In my view, I set up an exposed filter for content Types (Books / CDs / DVDs).
And a Relationship to show Content relating a "Documents" Entity Reference Field.
So, I get a page with a select box to show Documents related to the Content Type selected (Books / CDs / DVDs).

1) I would like to add a second select box or maybe checkboxes to filter by Document Type in order to display only Documents of type "lyrics" associated to CDs.
Is it possible ?

2) When a document is related by several entries, it appears multiple times. Is there a way to remove duplicates ? The goal here is to reach the document only.

3) Maybe it's not the right approach at all. I'm learning, so, I'm opened to any other approaches.

Thanks.

Comments

sachinsuryavanshi’s picture

Try with Grouping field from Setting section.

You can avoid duplicates with this filter.

heyow’s picture

Hmm, it doesn't work. I guess it is because it's displaying the field "Documents" of the parents, but the parent items are the displayed items and they are different.

Any idea for Document Types ?

adminMN2023’s picture

Heyow, take a look at this thread. It may be representative of the issue you are having. I ran into a problem with Grouped Filters which then lead me to a patch, which honestly, I have/had no idea how to install easily (my deadline is fast approaching and didn't have time to learn - I will go back later). So I went another route with my issue altogether.

https://www.drupal.org/node/2850190

heyow’s picture

I cheated too :D
My Document types don't need to be Content Types, taxonomy is perfect for that.
Thanks for this link, I discovered 3 useful modules that I'm sure I will use later.
In my project, there are a lot of filters and the BEF module will be perfect for a multi column filter with checkboxes. More visually intuitive, and the autosubmit, oh yes, that's one of many things I noted.
I think I will learn the grouped filters later, and the patch when I'll understand those.