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.
In #2075949: Add Libricons to messages, we came to the conclusion that the dblog module should update icon usage to SVG, following the new practices for implementation (see #2032773: Use Libricons (icon font) in Seven, consider using it more broadly in core).
This module uses the file "message-16-error.png" at:
Line 1430 in core/modules/filter/filter.module
Line 87 in core/modules/filter/lib/Drupal/filter/Tests/FilterHtmlImageSecureTest.php
They should be properly replaced with SVG substitutes.
Test Steps
- Create a piece of content
- In the body field, turn on the html source view and paste in the following:
<img src="http://google.com" />
- Save the content
Comment | File | Size | Author |
---|---|---|---|
#24 | 2083949-filter-icons-24.patch | 2.21 KB | LewisNyman |
#19 | 2083949-svg-image-filter-19.patch | 1.39 KB | Anonymous (not verified) |
#18 | 2083949-svg-image-filter-18.patch | 1.92 KB | LewisNyman |
#11 | icon-before.png | 14.55 KB | rteijeiro |
#11 | icon-after.png | 14 KB | rteijeiro |
Comments
Comment #1
klonos...less vague title (there are at least 3 issues with the same name: #2075949-10: Add Libricons to messages).
Comment #2
LewisNymantagging
Comment #3
LewisNymanThis one is different to the other icon issues because it's an img tag. This is a standalone theme function, so I think we could use the “onerror” technique here http://dbushell.com/2013/02/04/a-primer-to-front-end-svg-hacking/
Comment #4
LewisNymanComment #6
emma.mariaI have applied the patch in #4 and amended the test file so it should pass now.
Comment #7
emma.mariaComment #9
emma.mariaHere is a patch that contains the correct path to the image.
Comment #10
emma.mariaComment #11
rteijeiro CreditAttribution: rteijeiro commentedPatch applies cleanly and code seems right. Now the svg icon is shown so it's a RTBC for me ;)
BEFORE
AFTER
Comment #12
Wim LeersI'd like sign-off on this from nod_ as well, because of the technique being used to fall back to PNG files that's being used (as suggested in #3).
Comment #13
nod_inline event attribute is too much last centuary. Why not use the
and CSS fallback at the end of the article? no JS needed and we don't need to wait for something to fail to have the right image.Comment #14
LewisNyman@nod_ Which one is that? I assumed we can't use a CSS fallback like the other issues because this is inline html?
Comment #15
nod_Comment #15.0
nod_Added test steps
Comment #16
Wim LeersLet's move this one forward again? :)
Comment #17
LewisNymanOk lets do it! See: #2142655: [policy, no patch] Agree on a technique for loading SVG images in HTML that degrades to PNG
Comment #18
LewisNymanI had a go at this... and failed. Someone else with better OO chops feel free to have a go.
Comment #19
Anonymous (not verified) CreditAttribution: Anonymous commentedThis ought to do the trick – replaces the image node passed by reference with an object.
Comment #21
Anonymous (not verified) CreditAttribution: Anonymous commentedRight, I've had a thorough look at the tests for this, and this is my conclusion: I can't make a useful series of tests that rely on the output of the posted form, because all of the 'red x' images (
s) are the same. The test on the objects needs to be something like but I'm not able to identify them without looping through all of them, which seems both wasteful and not useful. Does anyone with more backend testing experience have any ideas as to how to make these tests work? I'm stumped!Comment #22
LewisNymanComment #23
LewisNymanRelated: #2286601: [policy] Drop support for browsers that don't support SVG
Comment #24
LewisNymanHere's a reroll of #9 as an example of how simple this is if we don't have to support png :)
Comment #25
LewisNymanWe now only support SVG and this work was completed in #2358675: Remove messages icons in misc