My Setup:
I am using Drupal 7.41 and Views / Views UI 3.11.
- I have a taxonomy named sermon series that includes a field called series image.
- I have a content type called sermons that has an image called sermon image and a term reference to the sermon series taxonomy.
- Lastly, I have a View called sermons that:
- pulls in the most recent 1 node from the content type sermons
- has a relationship to the taxonomy sermon series
- has the first field in the fields list as the sermon series image (from taxonomy) and is set to “hide from display”. The replacement pattern token for this field is [field_sermon_image_2]
- has the second field in the fields list as the sermon image (from content type) and is set to show in the display.
- this field has a no results behavior set to the token [field_sermon_image_2]
Expected Behavior:
If the most recent node has an image associated with it, that image will show. If there is no image associated with the node, it will show the image associated with the taxonomy sermon series.
Actual Behavior
When I create a node with the sermon image filled out, everything works as expected and the view shows the sermon image associated with the Node shows.
When I create a node without a sermon image filled out, the view correctly shows the sermon series image associated with the taxonomy sermon series.
Here’s where it gets weird. If I create a node without a sermon image filled out, see the view correctly show the sermon series image from the taxonomy, then either clear cache or wait until cache expires, no image shows up at all. I know the fallback is working correctly as even the [field_sermon_image_2] has a no results behavior fallback to a generic image and that’s what always shows up.
Through some testing, I found that unpublishing the node, viewing the view, then re-publishing the node will bring the correct image back (at least until the next cache flush).
I’m not sure where to look for this odd behavior. It seems like I have everything setup correctly in my view as I can get the correct images to show up, I just can’t get them to show up consistently.
Any advice you can give would be appreciated. Thanks!
Sponsored by SupremePR