- Issue created by @osopolar
- 🇩🇪Germany osopolar 🇩🇪 GER 🌐
I already found a hint to my issue, see hook_media_source_info_alter() in media_library.module (media_library_media_source_info_alter()): the form to create media entities got added there for some types. For the slideshow plugin (docroot/modules/contrib/media_entity_slideshow/src/Plugin/media/Source/Slideshow.php) the media_library_add is not defined. Therefore \Drupal\media_library\MediaLibraryUiBuilder::buildMediaTypeAddForm() returns an empty array:
if (empty($plugin_definition['forms']['media_library_add'])) { return []; }
Therefore the next step would be to add "add forms" for the other media plugins.
- 🇩🇪Germany osopolar 🇩🇪 GER 🌐
I have found how it might work: Add the media_library_add form to source info using hook_media_source_info_alter():
/** * Implements hook_media_source_info_alter(). */ function custom_module_media_source_info_alter(array &$sources) { if (empty($sources['podcast']['forms']['media_library_add'])) { $sources['podcast']['forms']['media_library_add'] = MediaNameForm::class; } }
And then implement the form, see for example docroot/core/modules/media_library/src/Form/OEmbedForm.php