- πΊπΈUnited States studgate
this works for me, great job @kevinquillen
- πΊπΈUnited States kevinquillen
Encountered this again and made a slight change on the project I am on.
/** * Implements hook_theme_suggestions_HOOK_alter(). */ function mytheme_theme_suggestions_menu_alter(array &$suggestions, array $variables) { if (isset($variables['menu_name'])) { /** @var \Drupal\menu_item_extras\Utility\Utility $utility */ $utility = \Drupal::service('menu_item_extras.utility'); if (Utility::checkBundleHasExtraFieldsThanEntity('menu_link_content', $variables['menu_name'])) { // menu_item_extras suggestions are taking precedent. // we need to re-take control here to support multiple menus. if (!empty($variables["menu_block_configuration"]["suggestion"])) { $suggestion_prefix = 'menu__extras'; $suggestions[] = $utility::suggestion($suggestion_prefix, $variables["menu_block_configuration"]["suggestion"]); } $suggestions = array_reverse(array_unique($suggestions)); } } }
For some reason I was seeing two menu--main.html.twig, and all the 'extras' suggestions appeared first. I reversed the array so I get the preferred behavior - use my standard templates that are in place if they exist in suggestions, before loading up menu--extras template(s).