0

One exposed filter for multiple views

I have an exposed filter which is a date field containing a month and year using the “date module”.

I want to use different views to read the URL and filter with a “Contextual Filter”. This is how the URL looks and I can see it has separated out the Month and Year;

?field_month_value%5Bvalue%5D%5Bmonth%5D=6&field_month_value%5Bvalue%5D%5Byear%5D=2016&=Apply. 

I know the contextual filter in views is looking for 062016 so I’m struggling to read the URL in the contextual filter. Is it possible to use PHP GET in the contextual filter to get the month and year and convert it to 062016?

if(isset($_GET[' field_month_value']))
    return $_GET[' field_month_value'];
else
    return;

I’m using D7. Thanks loads

1

From your question, I believe you want one exposed filter to reload the page when chosen and then all the other views on the page follow that filter?

A workaround if no one else answers is to expose the filter on all views and hide the ones you don't want with css. In each view, go to the filter's settings under Admin at the bottom and you can rename them all to field_month_value if they're different.

  • Ok, thanks for the response, sounds like it is what I am looking for. – user30505 Jul 18 '16 at 9:04

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.