- Issue created by @shaal
- Status changed to Needs review
10 months ago 5:50pm 11 June 2024 - Merge request !4fix: Add the loading="lazy" attribute to prioritize loading other resources first. β (Open) created by shaal
- Status changed to Needs work
10 months ago 1:31pm 12 June 2024 - πΊπΈUnited States lemming
Hi @shaal it's good to hear from you, I hope things are going well.
I think that this is a good idea, and I am happy to help get this ready. I have a couple items that I'm hoping to get your opinion on related to this.
- The module supports multiple types of icon types (icon handler plugins). For all the image based ones this is obvious, but for SVG sprite / symbols or for font based icons this should be ignored, or should these be "deferred"? We'll need to pass this option to the icon handler and have it decide how to apply the setting.
An existing example is how the "decorative" flag is being handled. The value is passed to the handler with the "IconHandlerInterface::build()" method and it builds the icon renderable array. -
I think the option can be applied at the iconset level and the field formatter (like with Drupal Core image). So I'm thinking of having an optional "loading" option (with a global default) that has:
- lazy - Icons are loaded lazy if the handler supports it - no option appears on formatter
- eager - Icons are loaded with eager attribute if appropriate - no option appears on formatter
- field - Setting is available per field - option appears on formatter with a preferred default pre-set
I'm interested in working on this more in the next week or so, if you don't beat me to it, but your input or ideas on this would be great. Especially on how you think this applies best to the other cases like font based icons (ignore this option?) and SVG Symbols & Sprites.
- The module supports multiple types of icon types (icon handler plugins). For all the image based ones this is obvious, but for SVG sprite / symbols or for font based icons this should be ignored, or should these be "deferred"? We'll need to pass this option to the icon handler and have it decide how to apply the setting.