Commit 9e05755f authored by Marc Ducobu's avatar Marc Ducobu
Browse files

RM en from available_languages close #330 / hide lang menu if only one...

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
parent 47bbd6ec
......@@ -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>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment