Media directories editor: Embed media widget: A thumbnail does not work

Created on 26 December 2023, 11 months ago
Updated 18 January 2024, 10 months ago

When using an Embed media widget, we noticed a thumbnail does not work. Looking on the source code I found wrong checking $entity instanceof Media.
A patch to be attached.

🐛 Bug report
Status

Fixed

Version

2.1

Component

Code

Created by

🇺🇦Ukraine Ruslan Piskarov Kiev, Ukraine

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

Comments & Activities

  • Issue created by @Ruslan Piskarov
  • @ruslan-piskarov opened merge request.
  • Status changed to Needs review 11 months ago
  • 🇺🇦Ukraine Ruslan Piskarov Kiev, Ukraine

    Result with a patch.

  • 🇮🇳India Sandeep_k New Delhi

    @Ruslan Piskarov, can you please share the steps to reproduce this?

  • 🇺🇦Ukraine Ruslan Piskarov Kiev, Ukraine

    @Sandeep_k, you can just open source code and you will see this Drupal\Core\Media is undefined.
    We use media_directories together with embed module and have a custom icon "Insert Media" in CKEditor.

  • 🇮🇳India Sandeep_k New Delhi

    Thanks for the details, I was able to reproduce this issue on the Drupal version 9.5.12-dev, and the patch was applied successfully but the issue is still not fixed. Sharing the steps below which I have followed, please share more details if you feel I am testing it wrong-

    • Download and install the Media Directories module.
    • Configure Embed media.
    • Go to Content and Embed media item. (Sharing results attached)

    Testing Results-
    Able to reproduce the issue & the patch was applied successfully. The issue was still not fixed for me after applying the patch.

  • 🇺🇦Ukraine Ruslan Piskarov Kiev, Ukraine

    @Sandeep_k,
    On /admin/config/content/embed/button/manage/media_directories choose the Media type = Image and the Entity browser "Media Directories: Editor widget"?
    On /admin/config/content/formats/manage/full_html add "Insert Media" widget (media_directories).

  • Status changed to RTBC 11 months ago
  • 🇮🇳India Sandeep_k New Delhi

    @Ruslan Piskarov Thanks, Patch worked for me now. Sharing the results below.
    Testing Results-
    Able to reproduce the issue & the patch was applied successfully. The issue was fixed after the patch was applied, attaching before & after results. RTBC+

  • Status changed to Fixed 11 months ago
  • 🇨🇭Switzerland ytsurk Switzerland

    Thank you for this solid contribution.

    Change makes absolute sense to me, interfaces shall be used to get back the preview always, and the thumbnail image style (100x100) can be replace with the media_library (200x200) one, both will be in place due to our dependencies.

    From D11, also 🐛 Media Library image style shouldn't be able to be deleted through the UI. Fixed

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024