This could be useful

Comments

pere orga’s picture

Could also provide alternatives to this: https://drupal.org/project/file_formatters

stefan lehmann’s picture

StatusFileSize
new1.29 KB

I just did this for one of our projects. Would be cool if it could go into the production version, so I can remove the module from the "patched" folder. Thank you!

PS: This patch is for version 1.3!

leon kessler’s picture

Status: Active » Needs work

Thanks, this looks good, except one thing...

+++ b/sites/all/modules/contrib/field_group_link/field_group_link.module
@@ -137,6 +140,10 @@ function field_group_link_field_group_pre_render(&$element, $group, &$form) {
+            $attributes['title'] = $field[0]['filename'];

This should probably come from somewhere the user has control over. E.g. if using the media browser widget you can add a description to the file (which gets stored in $field[0]['description']). There is also a title property on a file field, although I cannot workout how to submit data to it (but it could be that other modules are using it, so I don't see a harm in supporting it).

stefan lehmann’s picture

Yeah, good idea. Just one thing .. As far as I know the description field is optional. so it should probably fall back to the file name, if no description is given.

Surfing via phone. Will have a look next Monday, if you want to have a full patch. :-)

leon kessler’s picture

Yep sounds good,
I think it should probably look in $field[0]['title'], then $field[0]['description'] and then $field[0]['filename']

stefan lehmann’s picture

StatusFileSize
new1.57 KB

Updated the patch.

I tested it with a filled out description and without. And yeah .. also no clue how to fill that title field, but it should (fingers crossed) work, if so.

stefan lehmann’s picture

Status: Needs work » Needs review

  • leon.nk committed 1196619 on 7.x-1.x
    Issue #2217485 by Stefan Lehmann: Allow linking to a file field, adding...
leon kessler’s picture

Status: Needs review » Fixed

Awesome! Committed to dev.
I also added file field to the list of supported fields in the README.txt documentation.

Status: Fixed » Closed (fixed)

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