I am trying to allow the user to set a custom image to display in the header on node pages that have a header_image field and to display a default header image on all other pages (including system and module generated pages).
I thought I could do this by creating a "Header Image" view and using a contextual filter to get the header_image field on the displayed node. This works okay when displaying a node that has the header_image field but not on a page that doesn't have that field. Because this view is a block the contextual filter uses the default value of "Content ID from URL" and I can't use a fixed default value.
I am guessing I have to use the preprocess_page function and field_has_data or perhaps the Entity API Module to check if the node has data in the header_image field. If there is no header_image field or it has no value I would like to use the default image for that field. Is there anyway to specify using the default image that was set by the user? other wise I would use the default image at file_stream_wrapper_get_instance_by_uri('public://')->getDirectoryPath().'/default_images/default_header.jpg'
There must be a common solution to this problem.. Actually I just had a thought.. what if there are multiple nodes on a page? Any suggestions what I should do to accomplish this?