1) I created a content type Portfolio-Item. In this type a text field Project-Url was defined.

2) I created a view containing a gallery using jQFX module displaying content of Portofolio-Item elements which where published.

I wan't to add this view to different pages containing different projects portfolios.

a) Is it possible to add a "filter criteria" or "contextual filter" that would compere the Project-Url field with page URL and filter available Portfolio-Item's to display only proper one's. ?

b) Is there any easy way to achieve this?

c) Can contextual filter's be used with regular expressions?


Install the sandbox project Views arguments in filters (download it via Git)

With this module you can move a contextual filter down into the normal filters so that everything that you can do with normal filters can then be applied to the contextual filter.

How to use this module

To make use of this module, configure your view as usual, but use the following steps when adding arguments.

  • Use the argument "Global: Null" to denote the input arguments your view will make use of. This argument not alter your query in any way, but you can still use validators and actions if no argument is
    present as usual. And title, breadcrumbs, et cetera. Sweet.
  • Add a filter, and instead of adding a filter value manually, you enter %1, %2, et cetera to filter on the first or second input
    argument. That's it!

I would recommend you to use a Viewfield or the EVA Module. With both of them you can attach a view to an entity and add arguments. I personally prefer EVA to do stuff like this. Very handy and allows you to use the same in different contexts without exposing it to the site admin directly.

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.