- ๐บ๐ธUnited States jeffschuler Boulder, Colorado
srcset
can include multiple URIs.
See https://html.spec.whatwg.org/multipage/images.html#srcset-attributeWe should probably do as is done in Html::transformRootRelativeUrlsToAbsolute(): explode the comma-separated string that's within srcset="" and operate on each URI within.
Right now this module doesn't track where the attribute value ends, though. It should probably also mimic
transformRootRelativeUrlsToAbsolute()
and use XPath. But maybe you can keep this change simpler for the moment and look for the end quote of the attribute string? - ๐บ๐ธUnited States jeffschuler Boulder, Colorado
Note that if we do copy core for this, there's a bit of a mistake with where
Html::transformRootRelativeUrlsToAbsolute()
puts itssrcset
logic โ it shouldn't be within the loop over attributes.I opened an issue for that: ๐ Logic error in Html::transformRootRelativeUrlsToAbsolute() Fixed .
- ๐ณ๐ดNorway efpapado
I'm uploading for now a newer version of the patch to apply on 2.2.5 and I can check your replies about a different process.
- last update
about 1 year ago 1 fail - Status changed to Needs review
about 1 year ago 7:23am 28 November 2023 - ๐บ๐ธUnited States daniel korte Brooklyn, NY
@jeffschuler Maybe Iโm missing something, but why isnโt
Html::transformRootRelativeUrlsToAbsolute()
used in theprocess()
function instead of the current regex? - last update
about 1 year ago 2 fail - ๐บ๐ธUnited States jeffschuler Boulder, Colorado
@Daniel Korte : that would definitely be more DRY - and ultimately might also solve a few other issues like ๐ Do not convert Relative URLs beginning with // (v2.2.5) Needs review and ๐ Part of the path is lost after image path conversion Needs review ...
But one reason is that
transformRootRelativeUrlsToAbsolute()
uses a fixed set of$urlAttributes
, and I think it would be useful if this module were to โจ Allow choice of attributes to process Needs review .Ideally
transformRootRelativeUrlsToAbsolute()
would allow choosing params to include/exclude, but I'm not sure it's worth trying to change core for this use case. - ๐บ๐ธUnited States daniel korte Brooklyn, NY
@jeffschuler Got it. Sounds good. I think I can knock that out in the next day or so.
- last update
about 1 year ago 2 fail - last update
about 1 year ago 2 fail - ๐บ๐ธUnited States daniel korte Brooklyn, NY
I had to update the tests so the Filter is actually loaded with the settings. The code is mostly mirrored from core/modules/filter/tests/src/Kernel/FilterKernelTest.php
- last update
about 1 year ago 1 fail - ๐บ๐ธUnited States jeffschuler Boulder, Colorado
@Daniel Korte. Cool. I thought it would be easier for @podarok to review and commit โจ Allow choice of attributes to process Needs review separately since these issues accomplish different things, but let's see what he thinks.
- ๐บ๐ธUnited States daniel korte Brooklyn, NY
@jeffschuler Yeah, sorry, I wasnโt sure if I should have created a new issue or posted on that issue since the process function is completely different now. Also, though I finally figured out the tests. The test string wasnโt correct and the configuration wasnโt set.
- last update
about 1 year ago 1 pass - ๐บ๐ธUnited States daniel korte Brooklyn, NY
Applying the patch from ๐ Logic error in Html::transformRootRelativeUrlsToAbsolute() Fixed to our custom
transformRootRelativeUrlsToAbsolute()
function... - last update
about 1 year ago 1 pass