Request Support for Custom Media Types

Created on 24 May 2023, almost 2 years ago

Problem/Motivation

I ran through the documentation to test this module out. Very cool module, BTW. In order to not interfere with the core "Remote video" media type, I set up a custom media type based on the core "Remote video" type.

Steps to reproduce

The MicroModal functionality didn't manifest on the content page, of course. After running Xdebug I discovered the module file MicromodalFieldFormatter.php is hard coded to key in on the default `field_media_oembed_video` field. I hacked the module code and was able to get it working for my demo as shown:

      // Load the media item.
      $media_id = $item->getEntity()->id();
      $media = $this->entityTypeManager->getStorage('media')->load($media_id);

      // If the media loaded successfully, continue with the formatting.
      if (!empty($media) && !empty($formatter_type)) {

        // if (array_key_exists('field_media_oembed_video', $media->getFields())) {
        if (array_key_exists('field_media_oembed_video_2', $media->getFields())) {

          // Grab the remote video URL.
          // $video_url = $media->getFields()['field_media_oembed_video']->getValue()[0]['value'];
          $video_url = $media->getFields()['field_media_oembed_video_2']->getValue()[0]['value'];

Proposed resolution

Extend the module to include an admin UI for selecting additional media types, or possibly to specify which media_oembed fields to parse. There may be an even smarter way to do this, since I'm just superficially familiar with the module code at this point.

Remaining tasks

[ ] Chat about the options and if its worthwhile

User interface changes

* Possible admin UI page addition

API changes

None

Data model changes

Unknown

✨ Feature request
Status

Active

Version

1.0

Component

User interface

Created by

πŸ‡ΊπŸ‡ΈUnited States axb

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024