Currently there is not option to use a media formatter on file fields. The only additional option is the "Large filetype icon".

Given that the media field is deprecated, it would be great if the formatter was available for the generic file formatter, so we could start to use this on the 7.x-1.x branch.

Files: 
CommentFileSizeAuthor
#16 media-before-patch.png97.37 KBchris_h
#16 media-after-patch.png105.53 KBchris_h
#8 file_formatters-1390878-2.patch5.43 KBgollyg
PASSED: [[SimpleTest]]: [MySQL] 11 pass(es).
[ View ]
#4 file_formatters-1390878-2.patch1.14 KBgollyg
PASSED: [[SimpleTest]]: [MySQL] 11 pass(es).
[ View ]
#1 file_formatters-1390878-1.patch1.52 KBgollyg
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch file_formatters-1390878-1_0.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.
[ View ]

Comments

StatusFileSize
new1.52 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch file_formatters-1390878-1_0.patch. This may be a -p0 (old style) patch, which is no longer supported by the testbots.
[ View ]

Here is a patch that seems to work, but would need some testing. The biggest issue with it is the need to load the file entities for a second time to retrieve the bundle information. This happens already in a media_field_prepare_view, but this function does not get called prior to rendering the file field. I imagine there is another way of processing this file list in a more elegant way, as this patch means it is happening in at least two places.

Status:Active» Needs review

I have tested with standard file fields on Drupal 7.10. All seems to work as expected.

Status:Needs review» Needs work

The last submitted patch, file_formatters-1390878-1.patch, failed testing.

Version:7.x-1.0-rc2» 7.x-1.x-dev
Status:Needs work» Needs review
StatusFileSize
new1.14 KB
PASSED: [[SimpleTest]]: [MySQL] 11 pass(es).
[ View ]

Re-rolled against dev

Rather than re-using this formatter for the file type, I wonder if we should rather backport the 'Rendered file' formatter from File entity into Media 1.x's file_entity submodule - which would give us an added benefit of automatically supporting an upgrade path from 1.x to 2.x without any changes.

Yes, would make sense to keep it consistent with future versions. Will try to get onto a patch for that.

StatusFileSize
new5.43 KB
PASSED: [[SimpleTest]]: [MySQL] 11 pass(es).
[ View ]

Recreated the patch, using the suggested formatter. I have kept the formatter in the file.fields.inc and added an include statement to the main module, to keep it as close as possible to the 2.x branch.

Assigned:Unassigned» Dave Reid
Priority:Normal» Major

Upping priority and assigning for review.

After applying the patch and clearing cache I get
Fatal error: Cannot redeclare file_entity_view_mode_labels() (previously declared in /sites/all/modules/file_entity/file_entity.module:364) in /sites/all/modules/file_entity/file_entity.module on line 719

It appears that file_entity_view_mode_labels() and file_entity_view_mode_label() functions are both declared twice in the same module.

After removing douple declarations the functionality seems to works as defined. Works for me.

@wroxbox: If you are using the 7.x-1.x branch of Media, you should not have a sites/all/modules/file_entity module at all. You should have a sites/all/modules/media/file_entity since it's provided by Media and not a separate download.

@davereid: You are right. I installed file_entity first separately and then media.

I was trying to implement metadata to core file with file_entity without media.

Assigned:Dave Reid» Unassigned

Anyone please feel free to review.

tested & reviewed the patch with the result:

the media formatter is now available
good work! pleasure joining the sprint.

StatusFileSize
new105.53 KB
new97.37 KB

Tested on a fresh install with media 1.x-dev and media_youtube 1.0-beta3. The patch successfully adds rendered file option file formatter option (see attached before/after), which correctly displays a video, preview etc depending on view mode.

reviewed the patch and it looks solid. The only issue I found may be a non-issue: the .info file doesn't have a newline at the end. If that is irrevelent then this is RTBC

Removing tag, as 1.0 was released on March 23rd, regardless of this issue being tagged as a stable release blocker.

Applied and worked cleanly on 7.x-1.0 release

#8: file_formatters-1390878-2.patch queued for re-testing.

adding a tag; it would be nice to get an rtbc on this issue

we need to make sure we add an update function to clear the cache, so that we catch the new formatter.

Status:Needs review» Reviewed & tested by the community

Patch #8 worked like a charm. Thank you all for the help on this. It was greatly needed.

Status:Reviewed & tested by the community» Fixed

Status:Fixed» Closed (fixed)

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

Hi

I'm running the 7.x-1.1 version of the module but I am still unable to select the media format if I use a file field type and the Media file selector widget. I've enabled the module and set file display option under the file types menu, am I missing something?

Thanks ahead