0

So been looking at this for a bit now and nothing springing to mind so question and advice needed. On Drupal 8.

What I want: I have a content type with three date fields (Date A, Date B and Date C). Using a view I can create an exposed filter to filter dates between ranges, before, after, etc on say Date A. I can do the same for the other date fields.

I would like to restrict it to one date field at a time. So select the dates for Date A OR Date B OR Date C but never more than one date field.

Question Sounds simple. I cannot find a simple way to do this so unless I have missed the obvious am going to have to create a module. Before I look into that and start the ball rolling are there any existing solutions I have missed?

Assuming there is no easy way my thought was to create a new module.This would allow one date input and then a select box to choose which field to perform the operation on.

I have not yet looked at this in depth so as to using JS/AJAX to achieve this or a PHP solution (Class or hook), I am open to suggestions.

Thanks

  • And before it is suggested, yes I realise that it will probably mean I have to create my own exposed views filter - just want to check there is nothing obvious I am missing. – user82521 Mar 5 '18 at 17:08
  • Please note it is the functionality above I am after, not a close approximation. – user82521 Mar 5 '18 at 21:01
0

Create three different views, each with one exposed filter. Use css class to control visibility, use a bit of javascript to move around.

Refer How to create views tabs in D8?

  • Thanks for the suggestion. Whilst tabs work but not what I want. One view with exposed filter. Guess I will be writing my own exposed filter! – user82521 Mar 5 '18 at 21:00
  • So only way to get exactly what I want is to create a custom filter. – user82521 Mar 8 '18 at 22:58

Your Answer

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