Fontawesome menu icons 3508339 - Using custom icons from a kit
Problem/Motivation
We were not able to get our custom icons to display within the menu. The current list of prefixes does not include 'fak' which is necessary to access custom icons.
$form['fa_icon']['fa_icon_prefix'] = [ '#type' => 'select', '#title' => t('Style prefix'), '#default_value' => !empty($menu_link_options['fa_icon_prefix']) ? $menu_link_options['fa_icon_prefix'] : 'fa', '#options' => [ 'fa' => 'fa (' . t('4.x only') . ')', 'fas' => 'fas (' . t('5.x only') . ')', 'far' => 'far (' . t('5.x only') . ')', 'fal' => 'fal (' . t('5.x only') . ')', 'fad' => 'fad (' . t('5.x only') . ')', 'fab' => 'fab (' . t('5.x only') . ')', 'fa-solid' => 'Solid (' . t('6.x only') . ')', 'fa-regular' => 'Regular (' . t('6.x only') . ')', 'fa-light' => 'Light (' . t('6.x only') . ')', 'fa-thin' => 'Thin (' . t('6.x only') . ')', 'fa-duotone' => 'Duotone (' . t('6.x only') . ')', 'fa-brands' => 'Brands (' . t('6.x only') . ')', ], ];
Proposed resolution
Add 'fak' in the options list.
$form['fa_icon']['fa_icon_prefix'] = [ '#type' => 'select', '#title' => t('Style prefix'), '#default_value' => !empty($menu_link_options['fa_icon_prefix']) ? $menu_link_options['fa_icon_prefix'] : 'fa', '#options' => [ 'fa' => 'fa (' . t('4.x only') . ')', 'fas' => 'fas (' . t('5.x only') . ')', 'far' => 'far (' . t('5.x only') . ')', 'fal' => 'fal (' . t('5.x only') . ')', 'fad' => 'fad (' . t('5.x only') . ')', 'fab' => 'fab (' . t('5.x only') . ')', 'fak' => 'Custom Icons (' . t('6.x only') . ')', 'fa-solid' => 'Solid (' . t('6.x only') . ')', 'fa-regular' => 'Regular (' . t('6.x only') . ')', 'fa-light' => 'Light (' . t('6.x only') . ')', 'fa-thin' => 'Thin (' . t('6.x only') . ')', 'fa-duotone' => 'Duotone (' . t('6.x only') . ')', 'fa-brands' => 'Brands (' . t('6.x only') . ')', ], ];