Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have a File view, i.e. a view of type "File" whose base table is {files}. I would like to list only files that are present in a specific filefield. Typically, this would be done via a FileField relationship in the view, that joins the file table to the node table (via the various CCK tables). Is that currently possible?
The Upload: Node relationship, for example, implements this join between files and the nodes where they were uploaded via the Upload module.
Comment | File | Size | Author |
---|---|---|---|
#4 | filefield-views-files.patch | 1.37 KB | infojunkie |
#1 | filefield-views-files.patch | 1.35 KB | infojunkie |
Comments
Comment #1
infojunkie CreditAttribution: infojunkie commentedAttached is a patch to achieve what I need. In
filefield_field_settings_views_data
, I add the necessary declarations to find a "Content: Node" relationship that, when marked as required, shows only files that are attached to a certain filefield, and exposes the associated node data.Comment #2
quicksketchHm, interesting... I think this makes sense to include, but you could actually already accomplish the same thing if you started with a view of type "Node", then made a relationship over to the Files table. This patch just makes it so that you can do it both directions.
Comment #3
infojunkie CreditAttribution: infojunkie commentedYou're right, but in my case, I cannot start with a "Node" table, for other reasons.
Comment #4
infojunkie CreditAttribution: infojunkie commentedAttached is a slightly modified version where the new relationship is named after the field's label, instead of the generic "Node" label. This works better when multiple filefields exist.
Comment #5
quicksketchPatch works great. Thanks for your contribution infojunkie! Committed and will be in the 3.3 version.
Comment #6
quicksketch