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