I have a content type "Construction Job" with the title field renamed "Job #". When we create a new job, we assign it a unique job number in the title field.

I have two additional content types, "Update team 1" and "Update team 2". These content types have different fields because the work being done is different, but they share a field called "pictures". Each content type also has an entity reference field to the "Construction Job" content type so we can tie them together.

I'm trying to create a dashboard type display with various different views so management can review jobs with all of the information in one location. I'd like to create a slideshow off all of the pictures uploaded from either of the two update content types, and contextually filter that slideshow so that only the images from the updates for that particular "Construction Job" are shown.

I can create a separate slideshow view for the pictures from each respective Update type, but then I'm left with two separate slideshows on the same page. I'm trying to combine this into one slideshow as we're looking at adding a third different Update content type.

I've tried adding a contextual filter for each entity reference field from the two independent content type, but that doesn't work. That is I can create a contextual filter for the entity reference field for the first content type, but the view then eliminates all images from the second update content type. When I add the second contextual filter, the view returns no results when I enter a value in the filter preview.

3 Answers 3


I haven't tried anything exactly like this buts it sounds like it is very possible if you mess with your AND, OR settings. Since they share the same field and that is what you are filtering on there should be no issue with that being your contextual filter.

Look at your regular filters under 'Filter Criteria'. Filter on the content type in an OR group using 'And/Or, Rearrange' (the arrow next to 'Add'). And it should work.

  • Both of the content types have unique entity reference fields back to the "construction job". If I try to share this field between the two of them, I get an error when I try to save a new node for "update team 1" or "update team 2". So I created unique entity reference fields for each content type. Even though they are referencing the same entity type, I can't seem to share that between the content types. If I have 2 groups of filter criteria, separated with and OR, can I apply different contextual filters to those individual groups? I don't see where I can add an OR contextual filter.
    – Michael K.
    Commented Feb 27, 2016 at 1:24
  • Is there is conditional filter?
    – Michael K.
    Commented Feb 27, 2016 at 1:24
  • I know there is a way to do that. I imagine you have messed with the contextual filters quite a bit. Maybe try to mess with the relationships. I will take a look at this when I get off work and see if I can't remember how to get this done.
    – sareed
    Commented Feb 29, 2016 at 17:24
  1. That error shouldn't be there so fixing that would be an option.

  2. A likely Solution: Install https://www.drupal.org/project/views_argument_substitutions Add a "Global: Null" contextual filter and Provide default > Content ID. Then add regular OR filters using the replacement * * * ! 1 * * * (no spaces) for the entity reference fields.

Advice: Skip the multiple content types and use the conditional fields module to display different fields depending on a taxonomy field. So a taxonomy vocabulary with the terms Update Team 1, Update Team 2 etc.

If you don't want people to be able to choose, you can have an entity reference to a taxonomy and prepopulate and hide it with the url.

In views then, you filter by that term instead of by content type.

I trimmed like 10 content types down to one doing this. Much much easier to manage.

  • I've been considering using the conditional fields and consolidating them into one master "update" type. I already have a taxonomy field to designate which team the authenticated user is reporting on. I've used the conditional field module in other projects. My concern is that each of these updates has at least 15 fields and are both growing. I'm either going to have to manage two content types, or a bunch of conditional entries for each field I add to the mast type. There is talk of adding a 3rd update type for another team.
    – Michael K.
    Commented Feb 27, 2016 at 14:00
  • Hmm yea fair enough.. I had a lot of overlap and it was a one off thing so it made sense. Another interesting option could be conditional fields and field collections. You can still manage each Update set of fields separately but with a possibly nice benefit if there were multiple teams per update type.. Each team or person would have their own node which they add to and can take care off while the main views can show the collections as if they were nodes. Though your solution at the minute could be exactly what you need. Commented Feb 27, 2016 at 16:11
  • drupal.org/project/field_group would be good as well if you trust people to choose their Update tab.. Have all of the fields in one content type but group them per Update. Have common fields outside of the field groups and the others inside their tabs. Commented Feb 27, 2016 at 16:34

Thanks for the help.

I found this module, https://www.drupal.org/project/views_contextual_filters_or which worked perfectly.

I added two relationships, one for each entity reference in the respective Update types. I added two contextual filters filtering on the Content NID -> Provided in URL, each using one of the relationships I created.

With the module installed and activated, there is a check box under Advanced -> Query Settings. This checkbox modifies the query so all conditional filters are OR instead of AND.

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.