Download & Extend

Add relationship to the Node table based on FileField tables

Project:FileField
Version:6.x-3.2
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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.

Comments

#1

Category:support request» feature request
Status:active» needs review

Attached 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.

AttachmentSize
filefield-views-files.patch 1.35 KB

#2

Hm, 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.

#3

You're right, but in my case, I cannot start with a "Node" table, for other reasons.

#4

Attached 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.

AttachmentSize
filefield-views-files.patch 1.37 KB

#5

Status:needs review» fixed

Patch works great. Thanks for your contribution infojunkie! Committed and will be in the 3.3 version.

#6

Title:How can I link a File view to a filefield?» Add relationship to the Node table based on FileField tables

#7

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here