use Cubist\Backpack\app\Template\Navigation;
use Cubist\Backpack\app\Template\Redirection;
+use Illuminate\Support\Facades\App;
use Lavary\Menu\Menu as BaseMenu;
use Illuminate\Support\Facades\Cache;
public function get($key, $name = self::_STANDARD_PREFIX)
{
if ($name) {
- $key = $name . '_' . $key;
+ $key = $name . '_' . App::getLocale() . '_' . $key;
}
if (!$this->exists($key)) {
$this->makeAllMenus();
}
$href = $page->getHref();
- if ($href == '#' || $href == 'home') {
+ if ($href === '#' || $href === 'home') {
continue;
}
public static function internalToHref($url)
{
- if (stristr($url, 'internal:')) {
+ if (stripos($url, 'internal:') !== false) {
$e = explode(':', $url, 2);
$url = $e[1];
}
$this->makeStandardMenus($main);
}
+ $key = self::_STANDARD_PREFIX . '_' . App::getLocale() . '_breadcrumbs';
// Also make a menu for the breadcrumbs - this one is simpler and doesn't have the submenu headings
- $this->make(self::_STANDARD_PREFIX . '_breadcrumbs', function ($menu) use ($nav) {
+ $this->make($key, function ($menu) use ($nav) {
// Start with home link
$menu = $menu->add(__('Accueil'), '');
$this->_addToBreadcrumbs($nav, $menu);
public function makeStandardMenus($item)
{
- $this->make(self::_STANDARD_PREFIX . '_' . $item->getName(), function ($menu) use ($item) {
+ $this->make(self::_STANDARD_PREFIX . '_' . App::getLocale() . '_' . $item->getName(), function ($menu) use ($item) {
$this->makeStandardMenu($menu, $item);
});
- $this->make('mobile_' . $item->getName(), function ($menu) use ($item) {
+ $this->make('mobile_' . App::getLocale() . '_' . $item->getName(), function ($menu) use ($item) {
$this->makeMobileMenu($menu, $item);
});
foreach ($this->_registeredMenuMakers as $name => $registeredMenuMaker) {
- $this->make($name . '_' . $item->getName(), function ($menu) use ($item, $registeredMenuMaker) {
+ $this->make($name . '_' . App::getLocale() . '_' . $item->getName(), function ($menu) use ($item, $registeredMenuMaker) {
call_user_func($registeredMenuMaker, $menu, $item);
});
}
protected function _addToBreadcrumbs($nav, $menu)
{
if ($nav->getTitle() && $nav->isBreadcrumbs()) {
- if (substr($nav->getBreadcrumbHref(), 0, 1) == '#') {
+ if (strpos($nav->getBreadcrumbHref(), '#') === 0) {
$parent = $menu->raw($nav->getTitle());
} else {
$parent = $menu->add($nav->getTitle(), $nav->getBreadcrumbHref());