2
0
forked from Wavyzz/dolibarr

Fix #3322 Use title for alt if no alt is provided

alt has priority over title, so it should be filled if title is filled.
Use the title value to fill alt.
Unit test updated accordingly.
This commit is contained in:
Raphaël Doursenaud
2015-07-29 19:42:41 +02:00
parent cc49b39eb6
commit 2cf9d9f583
2 changed files with 3 additions and 3 deletions

View File

@@ -1906,7 +1906,7 @@ function img_picto($titlealt, $picto, $options = '', $pictoisfullpath = false, $
$tmparray=array(0=>$titlealt);
if (preg_match('/:[^\s]/',$titlealt)) $tmparray=explode(':',$titlealt); // We explode if we have TextA:TextB. Not if we have TextA: TextB
$title=$tmparray[0];
$alt=empty($tmparray[1])?'':$tmparray[1];
$alt=empty($tmparray[1])?$tmparray[0]:$tmparray[1]; // Use title for alt if no alt is provided
return '<img src="'.$fullpathpicto.'" border="0" alt="'.dol_escape_htmltag($alt).'"'.($notitle?'':' title="'.dol_escape_htmltag($title).'"').($options?' '.$options:'').'>'; // Alt is used for accessibility, title for popup
}
}