function SvgSpriteExtractor::extractIdsFromSymbols
Extract icon ID from SVG symbols.
Parameters
\SimpleXMLElement|null $wrapper: A SVG element.
Return value
array A list of icons ID.
1 call to SvgSpriteExtractor::extractIdsFromSymbols()
- SvgSpriteExtractor::extractIdsFromXml in core/
lib/ Drupal/ Core/ Theme/ Plugin/ IconExtractor/ SvgSpriteExtractor.php - Extract icon ID from XML.
File
-
core/
lib/ Drupal/ Core/ Theme/ Plugin/ IconExtractor/ SvgSpriteExtractor.php, line 93
Class
- SvgSpriteExtractor
- Plugin implementation of the icon_extractor.
Namespace
Drupal\Core\Theme\Plugin\IconExtractorCode
private function extractIdsFromSymbols(?\SimpleXMLElement $wrapper) : array {
if ($wrapper === NULL) {
return [];
}
$ids = [];
foreach ($wrapper as $symbol) {
if (isset($symbol['id']) && 0 === preg_match('/[^\\w-]/', (string) $symbol['id'])) {
$ids[] = (string) $symbol['id'];
}
}
return $ids;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.