Media browser integration?

Created on 18 March 2020, almost 5 years ago
Updated 10 September 2024, 3 months ago

This module provides a great way to create media-types such as "Remote image", "Remote document" - to mirror the default (local) "Image" and "Document" media-types.

However, the (core) media browser still displays the default file upload widget for such media types, rather than a URL field.

Would it be possible to include media browser integration so that users can add new remote media directly from the media browser (rather than having to create the media entity separately first)?

✨ Feature request
Status

Needs review

Version

1.2

Component

Code

Created by

🇬🇧United Kingdom robbm

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇬🇧United Kingdom 2dareis2do

    After looking at this my feeling is that the remote_stream_wrapper is not defined as a custom media bundle, which makes creating a media browser plugin more difficult

  • 🇨🇦Canada bohemier Québec city, Qc

    Since it seems there is no media library browser plugin yet, I wonder why does the module page say: Also provides a 'Remote URL' browser plugin for Media? There is also a feature opened to support an entity browser plugin here https://www.drupal.org/project/remote_stream_wrapper/issues/3066734 →

  • 🇬🇧United Kingdom 2dareis2do

    Yes, Entity Browser also implements this is a non standard way afaict.

  • First commit to issue fork.
  • 🇪🇸Spain unstatu

    I have implemented a first version of this feature.

    In order to use it you will have to create a media type using the "Remote file" source plugin. This "Remote file" plugin is provided by this patch.

    Then, you should be able to create media entities from the entity media form itself and also from the media library widget.

  • Status changed to Needs review 3 months ago
  • @unstatu opened merge request.
  • 🇬🇧United Kingdom 2dareis2do

    Thanks for posting this.

    I have tested this. i.e. add remote image file media type with Remote file plugin. This seems to create a "remote file field" in my case called "field_media_remote_file".

    I am not sure why this is created this way as opposed to just adding this remote file type field as field type?

    When adding a remote file this way the UI seems to work reasonably well, although there is no preview of the remote images. if using many images we need a way to distinguish one from another, at least visually.

  • 🇬🇧United Kingdom 2dareis2do
  • 🇬🇧United Kingdom 2dareis2do
  • First commit to issue fork.
  • 🇨🇭Switzerland das-peter

    The options to render the remote file seem very limited. There is not even an option to display as an image?

    That's what I thought too.
    All one has to do is to allow image as allowed_field_types in the source plugin.
    However, because file / image is somewhat special I think a dedicated source plugin should be provided.
    I've done that in the MR branch. It's pretty much just copy & paste from the code already provided with slight adjustments for the type and type check extension in the form class.

Production build 0.71.5 2024