Unverified Commit 77487a36 authored by Nicolas Widart's avatar Nicolas Widart Committed by GitHub

Merge pull request #517 from moebrowne/bugfix/localeless-menu-items-not-marked-as-active

Use LaravelLocalization When Generating Menu Item URIs
parents b19cafd4 a76c0c50
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace Modules\Menu\Providers; namespace Modules\Menu\Providers;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
use Modules\Core\Events\BuildingSidebar; use Modules\Core\Events\BuildingSidebar;
use Modules\Core\Events\LoadingBackendTranslations; use Modules\Core\Events\LoadingBackendTranslations;
use Modules\Core\Traits\CanGetSidebarClassForModule; use Modules\Core\Traits\CanGetSidebarClassForModule;
...@@ -122,7 +123,9 @@ class MenuServiceProvider extends ServiceProvider ...@@ -122,7 +123,9 @@ class MenuServiceProvider extends ServiceProvider
] ]
); );
} else { } else {
$target = $item->link_type != 'external' ? $item->locale . '/' . $item->uri : $item->url; $localisedUri = ltrim(parse_url(LaravelLocalization::localizeURL($item->uri), PHP_URL_PATH), '/');
$target = $item->link_type != 'external' ? $localisedUri : $item->url;
$menu->url( $menu->url(
$target, $target,
$item->title, $item->title,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment