mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
Adding locale selection
This commit is contained in:
parent
52c48f5b5d
commit
1ebb4662c1
@ -10,4 +10,9 @@ class DefaultController extends Controller
|
|||||||
{
|
{
|
||||||
return $this->render('ChillMainBundle::layout.html.twig');
|
return $this->render('ChillMainBundle::layout.html.twig');
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public function indexWithoutLocaleAction()
|
||||||
|
{
|
||||||
|
return $this->redirect($this->generateUrl('chill_main_homepage'));
|
||||||
|
}
|
||||||
|
}
|
@ -4,6 +4,14 @@ root:
|
|||||||
_controller: FrameworkBundle:Redirect:urlRedirect
|
_controller: FrameworkBundle:Redirect:urlRedirect
|
||||||
path: /homepage
|
path: /homepage
|
||||||
permanent: true
|
permanent: true
|
||||||
|
|
||||||
|
chill_main_homepage_without_locale:
|
||||||
|
pattern: /homepage
|
||||||
|
defaults: { _controller: ChillMainBundle:Default:indexWithoutLocale }
|
||||||
|
|
||||||
|
chill_main_homepage:
|
||||||
|
pattern: /{_locale}/homepage
|
||||||
|
defaults: { _controller: ChillMainBundle:Default:index }
|
||||||
options:
|
options:
|
||||||
menus:
|
menus:
|
||||||
section:
|
section:
|
||||||
@ -11,12 +19,8 @@ root:
|
|||||||
label: Homepage
|
label: Homepage
|
||||||
icon: home
|
icon: home
|
||||||
|
|
||||||
cl_chill_main_homepage:
|
|
||||||
pattern: /homepage
|
|
||||||
defaults: { _controller: ChillMainBundle:Default:index }
|
|
||||||
|
|
||||||
chill_main_admin_central:
|
chill_main_admin_central:
|
||||||
pattern: /admin
|
pattern: /{_locale}/admin
|
||||||
defaults: { _controller: ChillMainBundle:Admin:index }
|
defaults: { _controller: ChillMainBundle:Admin:index }
|
||||||
options:
|
options:
|
||||||
menus:
|
menus:
|
||||||
@ -39,4 +43,4 @@ logout:
|
|||||||
user:
|
user:
|
||||||
order: 10
|
order: 10
|
||||||
label: Logout
|
label: Logout
|
||||||
icon: power-off
|
icon: power-off
|
@ -49,16 +49,21 @@
|
|||||||
'layout': 'ChillMainBundle::Menu/user.html.twig',
|
'layout': 'ChillMainBundle::Menu/user.html.twig',
|
||||||
}) }}
|
}) }}
|
||||||
|
|
||||||
|
|
||||||
<li class="nav-link more"><a href="javascript:void(0)">FR</a>
|
<li class="nav-link more"><a href="javascript:void(0)">FR</a>
|
||||||
<ul class="submenu">
|
<ul class="submenu">
|
||||||
<li><a href="javascript:void(0)">FR</a></li>
|
{% for locale in ['fr', 'nl', 'en'] %}
|
||||||
<li><a href="javascript:void(0)">NL</a></li>
|
<li {% if locale == app.request.locale %}class="active"{% endif %}>
|
||||||
<li><a href="javascript:void(0)">EN</a></li>
|
<a href="{{ path(app.request.get('_route'), app.request.get('_route_params')|merge({'_locale' : locale})) }}">{{ locale | upper }}</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
{{ app.request.locale }}
|
||||||
|
|
||||||
{% block layout_content %}
|
{% block layout_content %}
|
||||||
<div class="container content">
|
<div class="container content">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user