diff --git a/superfish.theme.inc b/superfish.theme.inc index 390a7c7..0b18959 100644 --- a/superfish.theme.inc +++ b/superfish.theme.inc @@ -125,7 +125,7 @@ function template_preprocess_superfish_menu_items(array &$variables) { 'inActiveTrail' => $menu_item->inActiveTrail ); - if (!isset($item['options']['external'])) { + if ($menu_item->link->getUrlObject()->isRouted()) { // Adding the "is-active" class. $host = \Drupal::request()->getHttpHost(); $request_uri = \Drupal::request()->getRequestUri(); @@ -138,7 +138,7 @@ function template_preprocess_superfish_menu_items(array &$variables) { } // Adding the necessary "active-trail" class. - if ($item['inActiveTrail'] || array_key_exists($item['id'], $active_trails) || (!isset($item['options']['external']) && $menu_item->link->getUrlObject()->getRouteName() == '' && \Drupal::service('path.matcher')->isFrontPage())) { + if ($item['inActiveTrail'] || array_key_exists($item['id'], $active_trails) || ($menu_item->link->getUrlObject()->isRouted() && $menu_item->link->getUrlObject()->getRouteName() == '' && \Drupal::service('path.matcher')->isFrontPage())) { $item_class[] = 'active-trail'; }