Commit 1c7f1791 authored by dj3c1t's avatar dj3c1t

parameters dans config menus

parent ab5fead3
......@@ -7,13 +7,14 @@ use Symfony\Component\HttpFoundation\Response;
class ColonneController extends Controller {
public function displayAction($route) {
public function displayAction($route, $parameters) {
$dj3c1t_menus = $this->get("dj3c1t_app.menus");
$menu = $dj3c1t_menus->getMenu($route);
return $this->render(
'Dj3c1tAppBundle::sidebar.html.twig',
array(
"route" => $route,
"parameters" => $parameters,
"menu" => $menu,
)
);
......
......@@ -24,5 +24,5 @@ dj3c1t_menus:
items:
config:
route: account_configuration
label: Configuration
label: Compte
glyphicon: glyphicon-user
<ul class="nav nav-sidebar">
{% for item in menu %}
<li{% if route == item['route'] %} class="active"{% endif %}>
{% set active = false %}
{% if route == item['route'] %}
{% if item['parameters'] is defined %}
{% if parameters|length > 0 %}
{% set parameters_match = true %}
{% for key, value in parameters %}
{% set parameter_found = false %}
{% for ikey, ivalue in item['parameters'] %}
{% if key == ikey %}
{% set parameter_found = true %}
{% if ivalue != value %}
{% set parameters_match = false %}
{% endif %}
{% endif %}
{% endfor %}
{% if not parameter_found %}
{% set parameters_match = false %}
{% endif %}
{% endfor %}
{% if parameters_match %}
{% set active = true %}
{% endif %}
{% endif %}
{% else %}
{% if app.request.attributes.get('_route_params')|length == 0 %}
{% set active = true %}
{% endif %}
{% endif %}
{% endif %}
<li{% if active %} class="active"{% endif %}>
{% if item['parameters'] is defined %}
<a href="{{ path(item['route'], item['parameters']) }}">
{% else %}
<a href="{{ path(item['route']) }}">
{% endif %}
<span class="glyphicon {{ item['glyphicon'] }}" aria-hidden="true"></span>
{{ item['label'] }}
</a>
......
Markdown is supported
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