Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When users want to add a PDF or something else then you never want to user image styles etc. When a user now selects an image style then the user will now get an img tag with a wrong src.
Attached patch will always use the "link" format when you select a non-image file.
Comment | File | Size | Author |
---|---|---|---|
#5 | always_render_a_link-2680947-5.patch | 907 bytes | Johnny vd Laar |
#2 | 0001-Always-render-a-link-when-you-select-a-non-image-fil.patch | 1.16 KB | Johnny vd Laar |
Comments
Comment #2
Johnny vd Laar CreditAttribution: Johnny vd Laar at ezCompany commentedI thought that I had commit access... but I don't so the patch was made from a commit on my local repo... so it's not in the official patch layout. But I think that it'll still apply.
Comment #3
rudiedirkx CreditAttribution: rudiedirkx commentedCan't do this in 1.x, because contrib and custom will have added
[4]
with their own meta information. Non-existent 2.x could do it with a better data format (assoc array instead of 0-4).Or 1.x could do it in JS: don't check
file[4]
, but do an extension check in JS, with a new overridable JS method. I'll take that.Thank god you don't have commit access!
Comment #4
Johnny vd Laar CreditAttribution: Johnny vd Laar at ezCompany commentedHmm I'll take another shot.
Comment #5
Johnny vd Laar CreditAttribution: Johnny vd Laar at ezCompany commentedAnother attempt in JS. The check is in a separate function such that someone can override it.
Comment #6
rudiedirkx CreditAttribution: rudiedirkx commentedI like it, but I'll change
inArray
to just testing for(ext1|ext2)$
. Later.Comment #8
rudiedirkx CreditAttribution: rudiedirkx commentedVoila. Good addition!