So i figured out that in filefield_formatter.inc, if you change

return '

'. $icon . l($file['filename'], $url) .'

';

to

return '

'. $icon . l($file['data']['description'], $url) .'

';

you can change whether or not you have the description or the filename displayed as the textual link. I don't know how to make a radio button to add this into the menu, but if someone could that would be AWESOME!

Comments

jpetso’s picture

Status: Active » Needs review

Dude?! I added descriptions as default caption in filefield's 5.x versions already. What a mean world to bring that freaking filename back again.
Even if the description is optional, it should be pretty straightforward for filefield to include something like

$caption = empty($file['data']['description']) ? $file['filename'] : $file['data']['description'];
return '<div class="filefield-file clear-block">'. $icon . l($caption, $url) .'</div>';

...if just for the sake of nice defaults without the need for theming adaptions. Instead of the hardcoded filename caption in filefield_formatter.inc:65.
Sounds reasonable?

rhache’s picture

subscribing.

If I understand correctly, this issue is because the description field is not being used as the link text. That would be great if it could be fixed. However, I would recommend the following changes/upgrades as well:

  • Ability to choose if you want to show either the filename or the description in the cck display settings
  • Ability to have a default description that could utilize tokens

Sincerely,
Rene

gmreed’s picture

Subscribing.

dopry’s picture

Status: Needs review » Fixed

fixed in head... description is in the link title.

Status: Fixed » Closed (fixed)

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

davidwhthomas’s picture

Status: Closed (fixed) » Postponed (maintainer needs more info)

I made a small module ( file_info ) that provides formatters for :

1. Description
2. Description linked to file
3. Image title
4. Image alt

For use with filefield and imagefield.

This means in Views you could have a field for the image and a field for the description etc...
You can also show the description linked to the file instead of the filename.
The formatter may be selected from the display settings drop down.

Should I provide this as a contrib module, or perhaps as a patch to filefield?

DT

ademarco’s picture

That would be really useful. Subscribing.

quicksketch’s picture

davidwhthomas, Could you please open a new issue for this new feature request?

quicksketch’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)
bredi’s picture

@#6
where is it?

bredi’s picture

A Bad Solution!

=-=

I have no idea why one would want to print the name of the file underneath a movie or file..

I wasn't able to remove the filename with any of the options mentioned above with FFa7

So,
In the last line of filefield_formatter.inc

I simply changed the name of "filename to filename-disabled".

return '

' . $icon . l($file['filename'], $url, $options) . '

';
}

to

return '

' . $icon . l($file['filename-disabled'], $url, $options) . '

';
}

This essentially breaks the code. Which is not a great solution. But until there is one, this works...
I'm kinda thinking this is broken anyway...

Of course, you need to do this everytime you upgrade the module.

widget anyone?

aJob’s picture

Status: Closed (fixed) » Active

We Wants It

quicksketch’s picture

Status: Active » Closed (fixed)

Please open a new request.