I am experiencing this problem with the latest version of FileField (6.x-3.x-dev) together with the latest version of Biblio (6.x-1.x-dev). I attached a filefield node to Biblio types to upload pdfs. Biblio supports displaying filefield entries using FileField's API with this code:

if (module_exists('filefield')) { // now lets get any CCK FileField files...
$fields = filefield_get_field_list('biblio');
foreach ($fields as $field_name => $field) {
if (filefield_view_access($field_name)) {
$field_files = filefield_get_node_files($node, $field_name);
if ($field_files) {
foreach ($field_files as $file) {
if ($file['fid']) {
$files .= theme('filefield_file', $file);

The problem is that $field_files returned by filefield_get_node_files does not load the optional "description" data. A var_dump of the $file variable shows that. Because of this, theme() will print the file name in the link, instead of the appropriate description.

If you have biblio installed, you can see that this error occurs in the list of papers. When looking at the details of a node, the correct description is used (but I think that code comes directly from FileField, surpassing the external API).

#2 filefield_load_file_data.patch1.12 KBquicksketch
Members fund testing for the Drupal project. Drupal Association Learn more


quicksketch’s picture

Category: bug » feature

This is not necessarily a bug, since that API function has never retrieved things like the description or title. However the SQL query that takes place would have little to no performance difference if it did retrieve that extra information, since we're JOINing on the table anyway. I'll move this to a feature request, since I think it would make sense for that data to be retrieved.

Odder still, I have no idea why this function takes an entire $node object. Since if you've already got the node object, there's no need to do a full SQL query anyway, you already have all the information you need in $node->field_name.

quicksketch’s picture

Version: 6.x-3.x-dev » 6.x-3.2
Status: Active » Fixed
1.12 KB

I've added the attached patch which loads this additional data.

quicksketch’s picture

Title: field description is not loaded with filefield_get_node_files » Load file description and data when calling filefield_get_node_files()

Status: Fixed » Closed (fixed)

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