Default value setting of the Media type field works incorrect

Created on 4 October 2023, 9 months ago
Updated 13 October 2023, 9 months ago

Problem/Motivation

1. Site maintainer shouldn't have ability to interact with default value on form display page. No matter which widget is used on form display for Media type field (autocomplete, select list, or media library) - right now it's possible to delete default value of the media field.

2. Another problem is Allowed number of values field setting (check on screens below). On my example it's limited by 1. And what i see on form display page -> is that my default value is pre-filled (instead of to be real default value) and i have no ability to select another media. Because it's limited by 1 and already contains value. So if you will limit field let's say by 2 medias: first media will be default media, and you can choose only 1 custom media (instead of 2). To select 2 medias you have to manually "delete" default media.

Steps to reproduce

1. Standard profile installation
2. Enable "Media" and "Media Library" modules
3. Add to the any available content type new field with Media type
4. Fill default value
5. Limit this field by 1

✨ Feature request
Status

Active

Version

11.0 πŸ”₯

Component
MediaΒ  β†’

Last updated about 17 hours ago

Created by

πŸ‡·πŸ‡ΊRussia kostyashupenko Omsk

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

Comments & Activities

  • Issue created by @kostyashupenko
  • πŸ‡«πŸ‡·France andypost

    Not clear what's wrong with it and how you suggest to fix it.

    You need to upload media before it can be used as default value, probably you mean to add upload option to default value widget?

  • πŸ‡·πŸ‡ΊRussia kostyashupenko Omsk

    It's a bit different behaviors: default value and empty fallback media.
    Default value in our case - it is media, which will be pre-filled in media field on form display page. However, you can remove default media on form display page and click "Save". In that case media field will be empty. And no any media will be shown on display page at all. This is what i'm trying to achieve -> to be able to upload empty fallback media in the settings of media field. To always have media (even if media field is empty).

    We can't mix these behaviors: default value != empty fallback, so you can't use default value for these needs

  • πŸ‡·πŸ‡ΊRussia kostyashupenko Omsk

    Here i would like to have one more checkbox "Set media in case of empty field". So absolutely same behavior as for "Image" type field.

    Once checkbox is checked -> let's say we should show autocomplete below so we can select empty fallback media (image, or video, whatever else, based on selection of types of media above in the form)

  • πŸ‡«πŸ‡·France andypost

    Default value and fallback (cover) interesting idea, at least for media....need to sleep with it

  • πŸ‡·πŸ‡ΊRussia kostyashupenko Omsk

    Well this is how media works now. Site editor currently can just delete default value for media on form display page

  • πŸ‡·πŸ‡ΊRussia kostyashupenko Omsk

    Bump.

    Issue summary was completely reworked.

Production build 0.69.0 2024