public function FontAwesomeManager::getIconMetadata in Font Awesome Icons 8.2
Extract metadata for a specific icon.
Parameters
string $findIcon: The icon for which we want metadata.
Return value
array|bool Array containing icons.
Overrides FontAwesomeManagerInterface::getIconMetadata
File
- src/
FontAwesomeManager.php, line 213
Class
- FontAwesomeManager
- Icon Manager Service for Font Awesome.
Namespace
Drupal\fontawesomeCode
public function getIconMetadata($findIcon) {
// Parse the metadata file and use it to generate the icon list.
foreach ($this
->getMetadata() as $icon) {
if ($icon['name'] === $findIcon) {
// Determine the icon type - brands behave differently.
$type = 'solid';
foreach ($icon['styles'] as $style) {
if ($style == 'brands') {
$type = 'brands';
break;
}
}
return [
'name' => $icon['name'],
'type' => $type,
'label' => $icon['label'],
'styles' => $icon['styles'],
];
}
}
return FALSE;
}