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.
Hello,
I have a CCK node type set up with an imagefield widget/field which is not a required field, I've also set up a view but I want to filter on nodes which have an image/value. I'm looking in the filter section and I cannot see how to do this anywhere? Has any one any pointers where to start/ideas?
I'm currently using the folling versions of the modules, should that help,
Views - 6.x-2.1
CCK - 6.x-2.0-rc10
Imagefield - 6.x-3.0-alpha2
FileField - 6.x-3.0-alpha5
If this is posted in the wrong queue maybe the imagefield one let me know and I'll post there too.
Cheers
Rich
Comments
Comment #1
yched CreditAttribution: yched commentedFrom the Views issue submission guidelines :
"f you only read one of these submission guidelines, read this one. (Then please read the rest) If your problem deals exclusively with fields or filters provided by another module (CCK, Image, VotingAPI are common) please post the issue under the queue for that module first; all modules are responsible for telling Views about their own fields. It's possible Views IS at fault, but the module maintainers are the best people to make that determination, and they can kick the issue into the Views queue with an explanation of what's wrong if that is the case."
Please take the time to read those and comply. Might seem of little importance to you, but quickly gets really annoying for maintainers of modules with such huge issue queues as Views or CCK...
This is primarily an issue for Imagefield / Filefield (which imagefield relies on)
CCK default views integration provides a filter for fields which lets you pick 'Is empty / is not empty' options. However, filefield chooses to remove it and to provide no filter.
Bumping to filefield queue.
Comment #2
yched CreditAttribution: yched commentedDoh, failed to actually move the issue.
Comment #3
oliveyrc CreditAttribution: oliveyrc commentedSorry my bad on that one, I'll re post in the correct queue
Rich
Comment #4
oliveyrc CreditAttribution: oliveyrc commentedSorry, looks like we both posted at the same time, well started and moved back into views, changing now
Comment #6
dopry CreditAttribution: dopry commented@yched: I chose to remove it? Where? Did I overlook something? I'm pretty sure I implemented the content_empty code....
Comment #7
drewish CreditAttribution: drewish commentedyou need to add a relationship for the file or imagefield that you're interested in then add a filter for the file id field and specify the relationship you just created for your field.
Comment #9
vthirteen CreditAttribution: vthirteen commentedexpanding a little bit comment #7 @drewish:
to get the desired result, use a relationship for the filefield you want to filter nodes by, let's call it filefield "A" (for instance: "display/don't display nodes with empty filefield A").
make the relationship "required".
as for filters, just filter for the type of node which has that filefield or any other filter you might need, just don't filter again by the same filefield A, you don't need that and it might cause unexpected results.