Commit e9515155 authored by Henning Leutz's avatar Henning Leutz 🥋

fix: if alt is an array -> integrated checks

parent ad3aaa01
......@@ -268,7 +268,7 @@ abstract class Item extends QUI\QDOM
* Return the alt text
*
* @param null|QUI\Locale $Locale
* @return mixed
* @return string
*/
public function getAlt($Locale = null)
{
......@@ -286,7 +286,14 @@ abstract class Item extends QUI\QDOM
return $this->alt[$current];
}
return \reset($this->alt);
\reset($this->alt);
$result = \current($this->alt);
if (empty($result)) {
return '';
}
return $result;
}
//endregion
......
......@@ -473,6 +473,12 @@ class Utils
$img = '<img ';
foreach ($attributes as $key => $value) {
if (is_array($value) && $key === 'alt') {
$value = $Image->getAlt();
} elseif (!is_string($value)) {
continue;
}
$value = \htmlspecialchars($value, ENT_COMPAT, 'UTF-8');
$value = \htmlentities($value);
......
Markdown is supported
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