I'm filing this here as it's a problem in all the Media type provider modules I've seen so far (Image, Document, Video embed field) and so is possibly a problem in all of them.

In the media bundle form's Type provider configuration section, there is a 'Source Foo field'. This has no 'none' option.

The problem here is because there's no neutral 'None' option, the element can show something that is incorrect.

Consider this scenario:

- user creates a media bundle and selects the provider, and saves the form
- user creates a field on the bundle
- user returns to the media bundle edit form. The select element shows the one field they have created, because there is only one option and that's how HTML select elements work. However, the configuration does not have this field set. The user could at this point believe that the media bundle has automatically picked up the field for this setting, and not bother saving the form.

This is a UI bug because the UI is misleading the user about the state of the system.

Comments

joachim created an issue. See original summary.

marcoscano’s picture

xenophyle’s picture

In case this helps someone Googling for answers...

This UI bug led to image style derivatives not being generated and instead the default media icon was displayed.

marcoscano’s picture

Priority: Normal » Major
Issue tags: +D8Media

After the decision of making #2625854: Provide default source_field when creating new media entity bundles a core-only feature, I do see value in solving this UX issue, it is really confusing for first-time users.

woprrr’s picture

I suppose this is responsability of ThirdPartyForm providers to add an Empty option at Form element basis like

    '#empty_option' => t('- Skip field -'),
    '#empty_value' => MediaSourceInterface::METADATA_FIELD_EMPTY,

Same questions at end of my comment at ==> https://www.drupal.org/node/2918522#comment-12314272