Skip to content

Commit

Permalink
Revert "Fix #3322 Use title for alt if no alt is provided"
Browse files Browse the repository at this point in the history
This reverts commit 2cf9d9f.
  • Loading branch information
eldy committed Aug 12, 2015
1 parent 2c791e5 commit 25e729c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion htdocs/core/lib/functions.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2015,7 +2015,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[0]:$tmparray[1]; // Use title for alt if no alt is provided
$alt=empty($tmparray[1])?'':$tmparray[1];
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
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/phpunit/FunctionsLibTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -639,11 +639,11 @@ public function testImgPicto()

$s=img_picto('title','/fullpath/img.png','',1);
print __METHOD__." s=".$s."\n";
$this->assertEquals('<img src="/fullpath/img.png" border="0" alt="title" title="title">',$s,'testImgPicto3');
$this->assertEquals('<img src="/fullpath/img.png" border="0" alt="" title="title">',$s,'testImgPicto3');

$s=img_picto('title','/fullpath/img.png','',true);
print __METHOD__." s=".$s."\n";
$this->assertEquals('<img src="/fullpath/img.png" border="0" alt="title" title="title">',$s,'testImgPicto4');
$this->assertEquals('<img src="/fullpath/img.png" border="0" alt="" title="title">',$s,'testImgPicto4');

$s=img_picto('title:alt','/fullpath/img.png','',true);
print __METHOD__." s=".$s."\n";
Expand Down

0 comments on commit 25e729c

Please sign in to comment.