Problem/Motivation

In #1291428: Add a 'full' view mode and use it for file/%file pages a new "full" view mode was added for files and made default at file/%file.

Proposed resolution

Add "full" view mode to those added in hook_file_default_displays().

Comments

nedjo’s picture

Title: Add display settings for "full" file view mode » Add display settings for "full" file view mode for media_youtube
RobW’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Issue tags: +D7 stable release blocker

Adding tags. Media: Youtube should align with the future of Media and File Entity before we roll a stable release.

We should add a teaser view mode with defaults too, in anticipation of #1051090: Revamp file view modes: migrate media_small to teaser, media_large to full, media_preview to preview; deprecate link & original.

RobW’s picture

Title: Add display settings for "full" file view mode for media_youtube » Add display settings for "full", "teaser", and "preview" file view mode for media_youtube
Status: Active » Needs work
StatusFileSize
new3.69 KB

Worked on this a bit tonight. There are a lot of moving parts here:

#1291428: Add a 'full' view mode and use it for file/%file pages, which adds the full view mode to file entity.
#1296268: Add Preview and Teaser view modes, which adds preview and teaser view mode to file entity.
#1051090: Revamp file view modes: migrate media_small to teaser, media_large to full, media_preview to preview; deprecate link & original, which migrates old media view modes and settings to the new file entity view modes.

Here's the original issue adding the CTools exportables format to Media: #1141082: Provide a UI for identifying and reverting CTools Exportables overrides of file display configurations. Probably some good clues in there.

The patch attached does the obvious, which is to change the view mode names in media_youtube_file_default_displays(). The defaults do not populate the view modes in Manage file display. I tried a couple different versions of Media and File entity, and found that default formatters set here wouldn't show up on custom view modes, only on the original media_XXX view modes (which are removed by the above patches).

There's not much (any) documentation for hook_file_default_displays beyond other implementations of it which makes this harder to debug. CTools and file entity specialists feel free to chime in.

RobW’s picture

Consider the post above thinking out loud. I think the problems may have been on my end. Half way to fixing now.

RobW’s picture

Status: Needs work » Needs review
StatusFileSize
new3.43 KB

Ever debug step by step to arrive basically where you started, but things are magically working now? Yeah.

This patch adds defaults for the new view modes and keeps the old ones. There's no downside to defining defaults if the view mode doesn't exist, so I don't think there's any reason to remove support for older versions of Media 2.x.

RobW’s picture

Status: Needs review » Fixed
RobW’s picture

Status: Fixed » Needs work

Maybe we should use the "full" settings for "default", since that's what's available by... default on a clean Media install.

RobW’s picture

While Media defines a "full" view mode, it doesn't enable custom settings by default. Switched the "full" view mode formatters to "default" view mode so M:YT does something out of the box.

Commit: http://drupalcode.org/project/media_youtube.git/commit/2d4465a

RobW’s picture

Status: Needs work » Fixed

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