Skip to content
Snippets Groups Projects
Commit 15c204c6 authored by Andreas Fernandez's avatar Andreas Fernandez
Browse files

[BUGFIX] Use loading="lazy" in FormEngineUtility::getIconHtml()

The method `FormEngineUtility::getIconHtml()` is used in various places,
e.g. when rendering icons of a SelectIcons field wizard. If many icons
are loaded, the rendering process may take some time, depending on the
user's internet connection. To improve the initial rendering speed, the
icons are now lazy loaded.

Resolves: #94877
Releases: master, 10.4
Change-Id: I1ffb395124a7d9793188c7acdb039c3da698d41c
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/70573


Tested-by: default avatarBenjamin Kott <benjamin.kott@outlook.com>
Tested-by: default avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: default avatarFrank Nägler <frank.naegler@typo3.com>
Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: default avatarBenjamin Kott <benjamin.kott@outlook.com>
Reviewed-by: default avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: default avatarFrank Nägler <frank.naegler@typo3.com>
Reviewed-by: default avatarGuido Schmechel <guido.schmechel@brandung.de>
Reviewed-by: default avatarAndreas Fernandez <a.fernandez@scripting-base.de>
parent be8b169c
No related merge requests found
......@@ -125,6 +125,7 @@ class FormEngineUtility
$absoluteFilePath = GeneralUtility::getFileAbsFileName($icon);
if (!empty($absoluteFilePath) && is_file($absoluteFilePath)) {
return '<img'
. ' loading="lazy" '
. ' src="' . htmlspecialchars(PathUtility::getAbsoluteWebPath($absoluteFilePath)) . '"'
. ' alt="' . htmlspecialchars($alt) . '" '
. ($title ? 'title="' . htmlspecialchars($title) . '"' : '')
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment