public function FontAwesomeManager::getIconsByCategory in Font Awesome Icons 8.2
Get icons for a specific category.
Parameters
string $category_name: The name of the category to get icons for.
Return value
array All icons for this category.
File
- src/
FontAwesomeManager.php, line 94
Class
- FontAwesomeManager
- Icon Manager Service for Font Awesome.
Namespace
Drupal\fontawesomeCode
public function getIconsByCategory($category_name) {
// Get the categories for this icon.
$categories = $this
->getCategories();
// If this is a direct category key, return that.
if (isset($categories[$category_name])) {
return $categories[$category_name]['icons'];
}
else {
// A label may have been passed instead of a key.
foreach ($categories as $categoryData) {
if ($categoryData['label'] == $category_name) {
return $categoryData['icons'];
}
}
}
return [];
}