mirror of
				https://gitlab.com/Chill-Projet/chill-bundles.git
				synced 2025-10-31 01:08:26 +00:00 
			
		
		
		
	Adding locale selection
This commit is contained in:
		| @@ -10,4 +10,9 @@ class DefaultController extends Controller | ||||
|     {         | ||||
|         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 | ||||
|         path: /homepage | ||||
|         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: | ||||
|         menus: | ||||
|             section: | ||||
| @@ -11,12 +19,8 @@ root: | ||||
|                 label: Homepage | ||||
|                 icon: home | ||||
|  | ||||
| cl_chill_main_homepage: | ||||
|     pattern:  /homepage | ||||
|     defaults: { _controller: ChillMainBundle:Default:index } | ||||
|  | ||||
| chill_main_admin_central: | ||||
|     pattern: /admin | ||||
|     pattern: /{_locale}/admin | ||||
|     defaults: { _controller: ChillMainBundle:Admin:index } | ||||
|     options: | ||||
|         menus: | ||||
| @@ -39,4 +43,4 @@ logout: | ||||
|             user: | ||||
|                 order: 10 | ||||
|                 label: Logout | ||||
|                 icon: power-off | ||||
|                 icon: power-off | ||||
| @@ -49,16 +49,21 @@ | ||||
|                     'layout': 'ChillMainBundle::Menu/user.html.twig', | ||||
|                 }) }} | ||||
|  | ||||
|  | ||||
|                 <li class="nav-link more"><a href="javascript:void(0)">FR</a> | ||||
|                     <ul class="submenu"> | ||||
|                         <li><a href="javascript:void(0)">FR</a></li> | ||||
|                         <li><a href="javascript:void(0)">NL</a></li> | ||||
|                         <li><a href="javascript:void(0)">EN</a></li> | ||||
|                         {% for locale in ['fr', 'nl', 'en']  %} | ||||
|                             <li {% if locale == app.request.locale %}class="active"{% endif %}> | ||||
|                                 <a href="{{ path(app.request.get('_route'), app.request.get('_route_params')|merge({'_locale' : locale})) }}">{{ locale | upper }}</a> | ||||
|                             </li> | ||||
|                         {% endfor %} | ||||
|                     </ul> | ||||
|                 </li> | ||||
|             </ul> | ||||
|         </div> | ||||
|     </header> | ||||
|  | ||||
|     {{ app.request.locale }} | ||||
|      | ||||
|         {% block layout_content %} | ||||
|             <div class="container content"> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user