I have a content type where images are uploaded / managed with media module. Images have a mandatory entity reference field for the author. Now i want to show the author always next to the images. I can't get it to work. Last thing i tried was an entity view attachment, which works great if attached to the file itself, but not if attached to the node. I think the problem is the contextual filter. If i use the file-id the view takes the node id and shows the wrong author. If i try the node-id as contextual filter, it doesn't show anything (because the nodes have no author). How do i setup this configuration right?

Any help appreciated! Thanks!

  • Is the author field attached to the image? If so, is it possible to create a relation to this image in a view? Nov 23, 2015 at 15:53

1 Answer 1


Yes, ultimately a query needs the file ID. There are a few ways you can get the file ID considered. You should pick the mode most consistent with the rest of your site build:

  1. If you are using the Panels suite you then have a ton of options both within the "Views content panes" module (that comes as a part of CTools) and within Panels itself for setting up the passing of arguments. My main recommendation under this approach would be to use the "context" concept within panels to go from the node object to the file object that can then be passed to a contextual filter.

  2. You've tried Entity Views Attach. This works well if it is appropriate to show the author of the file within the View Mode of the file.

  3. You've also tried the "Provide default value" option under contextual filter handing but there isn't a suboption for "value from field X on current node". These are "default argument handlers" and here is the code for the one you are using: http://cgit.drupalcode.org/views/tree/modules/node/views_handler_argument_node_nid.inc and the generic API page for them: https://api.drupal.org/api/views/plugins!views_plugin_argument_default.inc/group/views_argument_default_plugins/7 If you are comfortable with PHP you can write one custom to your use case.

  4. Views Field View (https://www.drupal.org/project/views_field_view) is maybe the ugliest (but perhaps the easiest) option. It would allow you to construct a View that takes the argument of the NID (which you already have working) and using that to get the FID as field which would then be passed to another View. A View inside a View.

  • Thanks for pointing me in the right direction. I'll try your suggestions.
    – Volker
    Nov 27, 2015 at 9:43

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.