mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
RM en from available_languages close #330 / hide lang menu if only one language installed close #350 / The menu lang is generated from the config
This commit is contained in:
parent
47bbd6eca4
commit
9e05755f28
@ -52,9 +52,9 @@ class ChillMainExtension extends Extension implements PrependExtensionInterface
|
||||
$twigConfig = array(
|
||||
'globals' => array(
|
||||
'installation' => array(
|
||||
'name' => $config['installation_name']
|
||||
),
|
||||
'date_format' => 'd-M-Y'
|
||||
'name' => $config['installation_name']),
|
||||
'date_format' => 'd-M-Y',
|
||||
'available_languages' => $config['available_languages']
|
||||
),
|
||||
'form' => array(
|
||||
'resources' => array('ChillMainBundle:Form:fields.html.twig'))
|
||||
|
@ -27,6 +27,7 @@ class Configuration implements ConfigurationInterface
|
||||
->defaultValue('Chill')
|
||||
->end()
|
||||
->arrayNode('available_languages')
|
||||
->defaultValue(array('fr'))
|
||||
->prototype('scalar')->end()
|
||||
->end()
|
||||
->end();
|
||||
|
@ -50,16 +50,21 @@
|
||||
'layout': 'ChillMainBundle::Menu/user.html.twig',
|
||||
}) }}
|
||||
|
||||
|
||||
<li class="nav-link more"><a href="">{{ app.request.locale | upper }}</a>
|
||||
<ul class="submenu">
|
||||
{% 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>
|
||||
{% if available_languages|length == 1 %}
|
||||
<li class="nav-link">
|
||||
<a href="">{{ available_languages[0] | upper }}</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="nav-link more"><a href="">{{ app.request.locale | upper }}</a>
|
||||
<ul class="submenu">
|
||||
{% for lang in available_languages %}
|
||||
<li {% if lang == app.request.locale %}class="active"{% endif %}>
|
||||
<a href="{{ path(app.request.get('_route'), app.request.get('_route_params')|merge({'_locale' : lang})) }}">{{ lang | upper }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</header>
|
||||
|
Loading…
x
Reference in New Issue
Block a user