I thought I saw some implementation of this going on in dev but couldn't find an issue...marking major since it enables the user to select view modes that aren't setup or intended to be used.

When inserting media via the wysiwyg file browser, the view modes the user is able to select should be limited to only the modes enabled for the file type. For example if an 'application' file is chosen in the media browser, the next selection of view mode should be limited to the enabled view modes at /admin/structure/file-types/manage/application/display (under custom display settings).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Rob_Feature’s picture

Title: Limit View Modes to Enabled » Limit WYSIWYG View Modes to Enabled Modes

Clarifying title....

drzraf’s picture

Devin Carlson’s picture

Dave Reid’s picture

Agreed. Taking a look at this also makes me think there should be a 'default' view mode available as well.

Dave Reid’s picture

Status: Active » Needs review
FileSize
2.68 KB

Patch attached for review.

drzraf’s picture

It partially works, almost every view_modes are still available.

In my case I disabled file_styles_square_thumbnail but custom settings from entity_get_info('file') is still marked as TRUE.
Moreover, by only calling entity_get_info('file') how would you differentiate between an image for which a view_mode has been customized an another file bundle for which it hasn't been ?

Anyway, the only view_mode I never customized (token) disappeared after I applied the patch.

Dave Reid’s picture

I wasn't checking the proper function. Revised patch for review.

Dave Reid’s picture

Needed to be statically cached by file type.

drzraf’s picture

working, thanks !

Dave Reid’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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