Skip to content

Commit

Permalink
Fix(web-twig): SVG id must have a valid ID attribute value
Browse files Browse the repository at this point in the history
  • Loading branch information
janicekt committed Jan 28, 2025
1 parent 2b5daa9 commit b4b3dd0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/web-twig/src/Twig/SvgExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class SvgExtension extends AbstractExtension
private const ATTR_WIDTH = 'width';
private const SIMPLE_XML_ROOT_DECLARATION = "<?xml version=\"1.0\"?>\n";
private const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
private const SVG_ID_PREFIX = 'svg_';

/**
* @var array<string,SimpleXMLElement|false>
Expand Down Expand Up @@ -84,7 +85,7 @@ public function getInlineSvg(Environment $environment, string $path, array $para
}
}

$iconId = md5($path . serialize($params));
$iconId = self::SVG_ID_PREFIX . md5($path . serialize($params));

if (array_key_exists($iconId, $this->cacheReusableIconContent)) {
return $this->cacheReusableIconContent[$iconId];
Expand Down

0 comments on commit b4b3dd0

Please sign in to comment.