Deleting a Media view mode should not result in the deletion of an entire text format

Created on 11 December 2022, over 1 year ago
Updated 28 September 2023, 9 months ago

Problem/Motivation

Allowing the user to customize the media view modes that the user can select in the WYSIWYG unexpectedly creates a hard configuration dependency on the media view mode for the HTML format itself, even if the view mode is never used.

Steps to reproduce

  1. Install Drupal 9.5.x HEAD with the Standard profile.
  2. Enable the Media and Media Library modules.
  3. On /admin/structure/display-modes/view/add/media/, create a new view mode for Media called "Test" and click save.
  4. On /admin/structure/media/manage/image/display, under "Custom display settings", check "Test" and click save.
  5. On /admin/config/content/formats/manage/basic_html, add the media button to the WYSIWYG toolbar.
  6. Further down the page, check "Embed media".
  7. Further down still, open the "Embed media" vertical tab that becomes available.
  8. Under "View modes selectable in the 'Edit media' dialog", check "Default" and "Test". Click "Save".
  9. Go to /admin/structure/display-modes/view/manage/media.test/delete. It warns you that not only the unused view mode but also the editor config and the basic HTML input format are about to be deleted:
  10. If you don't read carefully, you may end up deleting the entire Basic HTML format, rendering your content both broken and uneditable in the process.

Proposed resolution

The selectable view modes for the media embed button should be treated as optional third-party settings that can be cleaned up from the editor and filter config entities, especially if they are never used. (Even if they are used, it'd be better to ignore a single data attribute rather than break the entire site's content.)

Remaining tasks

TBD

User interface changes

TBD

API changes

TBD

Data model changes

TBD

Release notes snippet

TBD

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Media 

Last updated 1 day ago

Created by

🇺🇸United States xjm

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024