From a first view I need to dynamically build an URL to add a link to another filtered view named gallery_details. I created a tpl template for my view where I build the URL like this one:


where field_main_categorie and field_categorie are the two used filters. When the two filters are "exposed" it works, but if I uncheck the exposed filters, this URL become invalid. I don't want to let the user to directly select the filters on gallery_details, also a solution may be to hide the exposed filters in gallery_details view.

I guess that there is a better solution.

  • If the filter isn't exposed, you shouldn't be able to set it via the URL - that would be be a bug, because, well, the filter would be exposed when you'd specifically asked for it not to be. If you don't want the form as an entry point to the filter, the simplest solution might be to use CSS to hide it
    – Clive
    Commented Dec 2, 2015 at 11:31
  • dynamically build an URL is this url going to change? If yes, based on what?
    – No Sssweat
    Commented Dec 2, 2015 at 11:35
  • @Clive use CSS to hide the form is what I would have to do if there is no other solution.
    – Pierre_C
    Commented Dec 2, 2015 at 15:54
  • @No Sssweat, yes the URL is aimed to change according to the filter used by the view where the URL is build.
    – Pierre_C
    Commented Dec 2, 2015 at 15:57

1 Answer 1


Have you tried using Contextual Filters in your view? It sounds like they do what you want.

  • Thanks Chris, it seems that's the solution. I did several tests without fully understand how filters are used. It seems that I can't use field_category=Anciens as in the classical filter
    – Pierre_C
    Commented Dec 2, 2015 at 16:21
  • Ok, now it works. I switched from "filter criteria" to "Contextual Filters" using the same filter fields, and building the following URL: http://www.example.org/?q=gallery-details/Anciens/dessin&page=2 where Anciens and dessin are the expected values for the two fields.
    – Pierre_C
    Commented Dec 2, 2015 at 17:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.