media_library view and form displays should be created if media type is created programmatically

Created on 15 November 2023, about 1 year ago
Updated 12 December 2023, 12 months ago

Problem/Motivation

In #2988433-27: Automatically create and configure Media Library view and form displays it was decided that _media_library_configure_form_display and _media_library_configure_view_display should only be run if a media type is created via the user interface.

I'm not 100% certain, but I'm inclined to agree, because the media library is also a UI concept, not an API concept, and this "Media Library" view and form modes are configuration that also only makes sense when using a UI.

To me that doesn’t really make sense, since you can programmatically create display modes. API-First shouldn’t be HTTP API first, but code API-First as well.

Steps to reproduce

Create a media type programmatically, or through the UI and forget to commit the view/form displays.

media_library doesn't use the proper display in the media library UI

Proposed resolution

Remove _media_library_media_type_form_submit in favor of hook_ENTITY_TYPE_insert of hook_media_type_insert

Remaining tasks

User interface changes

None

API changes

Data model changes

Release notes snippet

Feature request
Status

Active

Version

11.0 🔥

Component
Media 

Last updated about 2 hours ago

Created by

🇺🇸United States mglaman WI, USA

Live updates comments and jobs are added and updated live.
  • Usability

    Makes Drupal easier to use. Preferred over UX, D7UX, etc.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024