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.
Hi,
I tried to add fields on a views2 instance regarding title, alt and description data fields from a cck filefield multiple instance (an image gallery).
Then, I wish to create exposed filter on them. No default filters exist on that data. If I create a relationship on content - filefield fid, some filters arise, regarding upload time, dimension, file id, filename, .... but no one on title, alt or description.
How can I obtain that filters?
Alessandro
Comments
Comment #1
quicksketchThe image title, alt, and description fields are not filterable (nor sortable) because they are all stored in a single serialized column. So in short, you can't filter or sort on any of these fields and there is not an efficient way to do so.
Comment #2
quicksketchComment #3
patchrobe CreditAttribution: patchrobe commentedSorry to resurrect this issue but I had a similar problem and this may be of use to others - I needed a CCK field that allowed upload of multiple files and then selection from a drop down list to provide a description for each. Rather than create a custom content type I thought it would be more sensible to create a widget for filefield. However, this description needed to be available as a filter within views (i.e. show all nodes that contain a file with description "blah")
My solution was to create a series of textfields with checkbox widgets within the content type (corresponding to a yes/no for each description available) that were editable only by the superuser. Then with hook_nodeapi_presave, within the content type that contained the fields, all of the checkboxes were set to off and then switched on again if the corresponding filefield description existed. It was then possible to filter/expose the checkboxes within views to make the descriptions (indirectly) searchable.
A more generic solution might copy the title/alt/decription into a textfield using hook_nodeapi_presave, which could then be used for filtering
This is admittedly a little Heath Robinson and there is undoubtedly a more elegant solution but it does work.