public function FontAwesomeManager::getCategoriesByIcon in Font Awesome Icons 8.2
Get categories for a specific icon.
Parameters
string $icon_name: The name of the icon to get categories for.
Return value
array All categories for this icon.
1 call to FontAwesomeManager::getCategoriesByIcon()
- FontAwesomeManager::getIconsWithCategories in src/
FontAwesomeManager.php - Get icons with category data included.
File
- src/
FontAwesomeManager.php, line 73
Class
- FontAwesomeManager
- Icon Manager Service for Font Awesome.
Namespace
Drupal\fontawesomeCode
public function getCategoriesByIcon($icon_name) {
// Get the categories for this icon.
$categories = [];
foreach ($this
->getCategories() as $category_name => $data) {
if (in_array($icon_name, $data['icons'])) {
$categories[$category_name] = $data['label'];
}
}
return $categories;
}