function fontawesome_extract_icons in Font Awesome Icons 7.3
Same name and namespace in other branches
- 8 fontawesome.module \fontawesome_extract_icons()
- 7.2 fontawesome.module \fontawesome_extract_icons()
Provides a list of all available Font Awesome icons from metadata.
Return value
array Array containing icons.
1 call to fontawesome_extract_icons()
- fontawesome_icon_bundles in ./
fontawesome.module - Implements hook_icon_bundles().
File
- ./
fontawesome.module, line 597 - Drupal integration with Font Awesome 5.
Code
function fontawesome_extract_icons() {
$icons = array();
// Get the contents of the YAML file.
$content = file_get_contents(fontawesome_get_metadata_filepath());
// Parse the icons metadata.
foreach (json_decode($content) as $name => $icon) {
// Determine the icon type - brands behave differently.
$type = 'solid';
foreach ($icon->styles as $style) {
if ($style == 'brands') {
$type = 'brands';
break;
}
}
$icons[$name] = array(
'name' => $name,
'type' => $type,
'label' => $icon->label,
'styles' => $icon->styles,
);
}
return $icons;
}