1

We've transitioned to the media module for our Drupal 8 site. However, after extensive futzing, I can't figure out how to add a link to an embedded media image.

enter image description here

When you click on the media image, the image is highlighted, and you can right-click to get a menu. However, when I highlighted the image with a single-click, and then clicked on the link icon for the link dialog, the link was created just above the image.

enter image description here

I've also tried to click+drag my the cursor over the image, to highlight it (and whatever else I might get), and then use that multi-selected area, but I still get the same behavior.

How can I turn my media image into a clickable link?

Edit I thought this issue, Linking media thumbnail image to internal/external url might be about my situation. But, the patch (about a year old) doesn't apply anymore:

/core/modules/media 
$ patch -p1 < 2873754-8.patch
patching file src/Plugin/Field/FieldFormatter/MediaThumbnailFormatter.php
Hunk #1 FAILED at 11.
Hunk #2 succeeded at 66 (offset 4 lines).
Hunk #3 FAILED at 106.
Hunk #4 FAILED at 121.
Hunk #5 succeeded at 132 (offset 4 lines).
Hunk #6 succeeded at 163 with fuzz 2 (offset 7 lines).
Hunk #7 FAILED at 177.
Hunk #8 succeeded at 214 with fuzz 2 (offset 14 lines).
4 out of 8 hunks FAILED -- saving rejects to file src/Plugin/Field/FieldFormatter/MediaThumbnailFormatter.php.rej
  • I typically add a link field on the media type - the entity browser should present a form that asks for those fields. Then I render the media object with the link wrapping the image. I haven't really found any other way. – Kevin May 2 '18 at 15:35
1

I found this issue, which has a series of patches and perhaps a module. I'm about to go into testing; perhaps-- hopefully-- coming out with a solution, but for now, there is not a clear solution.

Edit I applied the patch from comment #47, and it seems to work. At the time of writing, it's only 9 days old, but we're rolling with it since we need to link images.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.