Skip to content

Commit

Permalink
Adds a call to LaravelLocalization when generating menu item URIs so …
Browse files Browse the repository at this point in the history
…locale settings are respected
  • Loading branch information
moebrowne committed Apr 15, 2018
1 parent a795021 commit 96bc10f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Providers/MenuServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Modules\Menu\Providers;

use Illuminate\Support\ServiceProvider;
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
use Modules\Core\Events\BuildingSidebar;
use Modules\Core\Events\LoadingBackendTranslations;
use Modules\Core\Traits\CanGetSidebarClassForModule;
Expand Down Expand Up @@ -122,7 +123,9 @@ public function addItemToMenu(Menuitem $item, Builder $menu)
]
);
} 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(
$target,
$item->title,
Expand Down

0 comments on commit 96bc10f

Please sign in to comment.