If "Generic file" formatter is used and a file has been given a 'description', it should display the 'desciption' instead of the file name. This was working on 3.3 and earlier.

Image attached displays a view that lists 3 files. All 3 have been given descriptions. But the Generic field is displaying the file name instead of the description.

CommentFileSizeAuthor
#2 3.3.jpg39.7 KBharcher
#2 3.6.jpg30.17 KBharcher
generic-field.jpg12.06 KBharcher
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

harcher’s picture

FileSize
30.17 KB
39.7 KB

I did this already and applied it to 3.6:
http://drupal.org/node/841212#comment-3150628

Looking at the file filefield/filefield_formatter.inc, I noticed that the $file['data'] doesn't have the variable 'description'. This is why the 'if' statement on line 138 executes and uses $file['filename'] as the link text:

  firep($file,'file');

  // Use the description as the link text if available.
  if (empty($file['data']['description'])) {
    $link_text = $file['filename'];
  }
  else {
    $link_text = $file['data']['description'];
    $options['attributes']['title'] = $file['filename'];
  }

I did a firep to inspect the array $file on 3.3 and 3.6. Notice that on 3.3 you have a 'description' variable but 3.6 doesn't.

quicksketch’s picture

Status: Active » Postponed

#12 in #841212 should now fix this problem too. I'm leaving this issue open but moving to postponed, since all these issues have to do with unserializing the "data" column.

See #841212-12: warning: array_merge() [function.array-merge]: Argument #1 is not an array in..../filefield_field.inc on line 292.

quicksketch’s picture

Status: Postponed » Fixed

Version 3.7 is now available. Sorry for the troubles everyone.

Status: Fixed » Closed (fixed)

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