Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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).
Comment | File | Size | Author |
---|---|---|---|
#8 | 1632502-wysiwyg-limit-view-modes.patch | 2.89 KB | Dave Reid |
#7 | 1632502-wysiwyg-limit-view-modes.patch | 2.82 KB | Dave Reid |
#5 | 1632502-wysiwyg-limit-view-modes.patch | 2.68 KB | Dave Reid |
Comments
Comment #1
Rob_Feature CreditAttribution: Rob_Feature commentedClarifying title....
Comment #2
drzraf CreditAttribution: drzraf commentedprobably related #1421444: Does media_format_form() selects file styles the right way ?
Comment #3
Devin Carlson CreditAttribution: Devin Carlson commentedMarked #1637310: File Types-> Manage Display ineffective after configuration. as a duplicate.
Comment #4
Dave ReidAgreed. Taking a look at this also makes me think there should be a 'default' view mode available as well.
Comment #5
Dave ReidPatch attached for review.
Comment #6
drzraf CreditAttribution: drzraf commentedIt partially works, almost every view_modes are still available.
In my case I disabled
file_styles_square_thumbnail
butcustom settings
fromentity_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.Comment #7
Dave ReidI wasn't checking the proper function. Revised patch for review.
Comment #8
Dave ReidNeeded to be statically cached by file type.
Comment #9
drzraf CreditAttribution: drzraf commentedworking, thanks !
Comment #10
Dave ReidCommitted #8 to Git:
http://drupalcode.org/project/media.git/commit/2b2acd6 (7.x-2.x)
http://drupalcode.org/project/media.git/commit/76e7f47 (7.x-1.x)