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.
This seems like it should be a simple thing to do, but I haven't found a good way yet.
Filefield is working great for me except I'd like to rewrite the output so that instead of displaying the actual filename I'd like to have generic text, like "download the pdf here". I suppose to do this within CCK there would need to be a different display preset other than "generic files". Is there some way to do this that I'm missing? Any help on this would be appreciated.
Comments
Comment #1
quicksketchYou can do this by overriding theme_filefield_item() in your theme.
Comment #2
giorgio79 CreditAttribution: giorgio79 commentedJust been looking for this.
quicksketch would you consider an additional and optional link to download the file stored by Filefield?
Sg like http://drupal.org/project/filenode with url masking.
Or no new features in D6?
Comment #3
quicksketchProbably not. This problem is already solvable by theming the theme_filefield_item() function and (as you mentioned), no new features are being added to ImageField.
Comment #4
giorgio79 CreditAttribution: giorgio79 commentedOk, thanks quicksketch
Comment #5
giorgio79 CreditAttribution: giorgio79 commentedComment #6
eriklharper CreditAttribution: eriklharper commentedI've taken a look at the code for the function you mentioned and can't see how I would go about overriding this to change all file links to the word "download" rather than display the file name. Can you show us some sample code to do this?
Comment #7
dale386 CreditAttribution: dale386 commentedI am looking for a way to change the display of a file in a view, which is not possible by overriding theme_filefield_item(). Any suggestions?
Comment #8
grasmash CreditAttribution: grasmash commented@dale386
Check out my short post on Customizing the filefield format in views
Also, overriding filefield theming using theme_filefield_item()