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

gollyg’s picture

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.

gollyg’s picture

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.

gollyg’s picture

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

Dave Reid’s picture

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.

gollyg’s picture

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

Dave Reid’s picture

gollyg’s picture

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.

Dave Reid’s picture

Assigned:Unassigned» Dave Reid
Priority:Normal» Major

Upping priority and assigning for review.

wroxbox’s picture

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.

wroxbox’s picture

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

Dave Reid’s picture

@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.

wroxbox’s picture

@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.

Dave Reid’s picture

Assigned:Dave Reid» Unassigned

Anyone please feel free to review.

discipolo’s picture

tested & reviewed the patch with the result:

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

chris_h’s picture

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.

cosmicdreams’s picture

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

Taxoman’s picture

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

marvil07’s picture

Chaulky’s picture

Applied and worked cleanly on 7.x-1.0 release

aaron’s picture

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

aaron’s picture

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

aaron’s picture

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

FatGuyLaughing’s picture

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.

aaron’s picture

Status:Reviewed & tested by the community» Fixed

Status:Fixed» Closed (fixed)

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

ratface’s picture

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