2
0
forked from Wavyzz/dolibarr

Optimize size of html

This commit is contained in:
Laurent Destailleur
2021-08-10 19:44:55 +02:00
parent 21df418468
commit f48a9aa3ad
2 changed files with 8 additions and 6 deletions

View File

@@ -3790,7 +3790,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
return $fullpathpicto;
}
// tag title is used for tooltip on <a>, tag alt can be used with very simple text on image for blind people
return '<img src="'.$fullpathpicto.'" alt="'.dol_escape_htmltag($alt).'"'.(($notitle || empty($titlealt)) ? '' : ' title="'.dol_escape_htmltag($titlealt).'"').($moreatt ? ' '.$moreatt.($morecss ? ' class="'.$morecss.'"' : '') : ' class="inline-block'.($morecss ? ' '.$morecss : '').'"').'>'; // Alt is used for accessibility, title for popup
return '<img src="'.$fullpathpicto.'"'.($notitle ? '' : ' alt="'.dol_escape_htmltag($alt).'"').(($notitle || empty($titlealt)) ? '' : ' title="'.dol_escape_htmltag($titlealt).'"').($moreatt ? ' '.$moreatt.($morecss ? ' class="'.$morecss.'"' : '') : ' class="inline-block'.($morecss ? ' '.$morecss : '').'"').'>'; // Alt is used for accessibility, title for popup
}
/**
@@ -3850,10 +3850,11 @@ function img_weather($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $mo
* @param string $picto Name of image file to show (If no extension provided, we use '.png'). Image must be stored into htdocs/theme/common directory.
* @param string $moreatt Add more attribute on img tag
* @param int $pictoisfullpath If 1, image path is a full path
* @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip.
* @return string Return img tag
* @see img_object(), img_picto()
*/
function img_picto_common($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0)
function img_picto_common($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0, $notitle = 0)
{
global $conf;
@@ -3875,7 +3876,7 @@ function img_picto_common($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0
}
}
return img_picto($titlealt, $path, $moreatt, 1);
return img_picto($titlealt, $path, $moreatt, 1, 0, $notitle);
}
/**
@@ -8126,9 +8127,10 @@ function dol_validElement($element)
*
* @param string $codelang Language code ('en_IN', 'fr_CA', ...) or ISO Country code on 2 characters in uppercase ('IN', 'FR')
* @param string $moreatt Add more attribute on img tag (For example 'style="float: right"' or 'class="saturatemedium"')
* @param int $notitlealt No title alt
* @return string HTML img string with flag.
*/
function picto_from_langcode($codelang, $moreatt = '')
function picto_from_langcode($codelang, $moreatt = '', $notitlealt = 0)
{
if (empty($codelang)) {
return '';
@@ -8161,7 +8163,7 @@ function picto_from_langcode($codelang, $moreatt = '')
$flagImage = empty($tmparray[1]) ? $tmparray[0] : $tmparray[1];
}
return img_picto_common($codelang, 'flags/'.strtolower($flagImage).'.png', $moreatt);
return img_picto_common($codelang, 'flags/'.strtolower($flagImage).'.png', $moreatt, 0, $notitlealt);
}
/**