function micon_vocabulary_micon_icons_alter in Micon 8
Same name and namespace in other branches
- 2.x micon_vocabulary/micon_vocabulary.module \micon_vocabulary_micon_icons_alter()
Implements hook_micon_icons_alter().
File
- micon_vocabulary/
micon_vocabulary.module, line 56 - Contains micon_vocabulary.module.
Code
function micon_vocabulary_micon_icons_alter(&$icons) {
$defaults = [
'text' => '',
'regex' => '',
'weight' => 0,
'provider' => 'micon_vocabulary',
];
$types = \Drupal::entityTypeManager()
->getStorage('taxonomy_vocabulary')
->loadMultiple();
foreach ($types as $type) {
if ($icon = micon_vocabulary_icon($type)) {
$id = 'vocabulary.' . $type
->id();
$icons[$id] = [
'text' => 'vocabulary.' . strtolower($type
->label()),
'icon' => $icon,
'id' => $id,
] + $defaults;
}
}
}