Only set a default name for the media item if mapped in the media source

Created on 28 November 2020, over 4 years ago
Updated 8 May 2024, 12 months ago

Problem/Motivation

A generated name for media entities is not alway a good idea, especially for document media types, where a descriptive and searchable title would be better.

Between the media entity form and the media modal upload widget , there is an inconsistency between how the media name basefield is applied, when the field is not hidden from the form.

In #2882473: Hide the media name basefield from the entity form by default it was stated that "Probably 80% of the use cases will want this populated automatically".

For images, I agree this is probably true. But in the case of documents, some installations will want to provide a descriptive and searchable media name. Both for use on the frontend and also in the media library.

The inconsistency arrises because the media modal upload widget pre-populates the name field with a generated value and this can result in media being named inappropriately.

Steps to reproduce

Upload some media.
1. Directly via the path /media/add/document
2. Via a media enabled content type using the media library modal.

1. In the case of the default form mode from the media module.
- On creating a new document, an empty (and required) input is provided.
- The content creator has to provide a name before the form can be saved.

2. The media modal upload widget behaves differently.
- On creating a new document, the name field is pre-populated with a generated name, as would happen if the field was hidden.
- The content creator does not have to provide an alternative before saving the form.

---
In the original feature request it was suggested that "if the name basefield is visible on the entity form, it should be entered by a human and should not be pre-populated.

However, during the Drupal Usability Meeting - 2020-12-04 it was concluded that such an approach would be unsuitable and may cause problems for existing sites. See comment 15.

Proposed resolution

Only set a default name for the media item if mapped in the media source.

Remaining tasks

1. Agree that a worthwhile UX improvement could be implemented.

2. Develop a patch.

User interface changes

When the Media type does not provide a mapping for the media's name, the Name field has to be filled out manually.

API changes

Data model changes

Release notes snippet

Feature request
Status

Needs work

Version

11.0 🔥

Component
Media 

Last updated 23 minutes ago

Created by

🇬🇧United Kingdom mrpauldriver

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

Merge Requests

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.71.5 2024