Add categories overview
This commit is contained in:
		@@ -13,21 +13,21 @@ class ParameterController extends BaseController
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @Route("/{category}", name="parameter_bundle_parameters")
 | 
					     * @Route("/{category}", name="parameter_bundle_parameters")
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public function parameters($category,
 | 
					    public function parameters($category = 'categories',
 | 
				
			||||||
                               ParameterService $param,
 | 
					                               ParameterService $param,
 | 
				
			||||||
                               Request $request)
 | 
					                               Request $request)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $configs = $param->getConfig();
 | 
					        $configs = $param->getConfig();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Handle all special cases for the name
 | 
					        // Handle all special cases for the name
 | 
				
			||||||
        /*if ('list' === $name) { // List all the categories
 | 
					        if ('categories' === $category) { // List all the categories
 | 
				
			||||||
            $routes = [];
 | 
					            $categories = [];
 | 
				
			||||||
            foreach ($configs as $key => $config) {
 | 
					            foreach ($configs as $key => $config) {
 | 
				
			||||||
                $routes[] = ['route' => 'parameters', 'params' => ['name' => $key], 'title' => $key];
 | 
					                $categories[] = $key;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            $categories[] = 'all';
 | 
				
			||||||
            return $this->render('list.routes.twig', ['routes' => $routes]);
 | 
					            return $this->render('@ArdentParameter/categories.html.twig', ['categories' => $categories]);
 | 
				
			||||||
        } else*/if ('all' === $category) { // Show all parameters from all categories
 | 
					        } elseif ('all' === $category) { // Show all parameters from all categories
 | 
				
			||||||
            $allConfigs = [];
 | 
					            $allConfigs = [];
 | 
				
			||||||
            foreach ($configs as $config) {
 | 
					            foreach ($configs as $config) {
 | 
				
			||||||
                $allConfigs = array_merge($allConfigs, $config);
 | 
					                $allConfigs = array_merge($allConfigs, $config);
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										9
									
								
								Resources/views/categories.html.twig
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								Resources/views/categories.html.twig
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
				
			|||||||
 | 
					{% extends '@ArdentParameter/layout.html.twig' %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					{% block par_user_content %}
 | 
				
			||||||
 | 
					    <h2>Parameter categories</h2><br>
 | 
				
			||||||
 | 
					    {% for category in categories %}
 | 
				
			||||||
 | 
					        <a class="btn-primary btn" href="{{ path('parameter_bundle_parameters', {category:category}) }}">{{ category }}</a><br><br>
 | 
				
			||||||
 | 
					    {% endfor %}
 | 
				
			||||||
 | 
					{% endblock %}
 | 
				
			||||||
@@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					{# Add extra content on the bottom of the form #}
 | 
				
			||||||
@@ -1,8 +1,8 @@
 | 
				
			|||||||
{% extends '@ArdentParameter/layout.html.twig' %}
 | 
					{% extends '@ArdentParameter/layout.html.twig' %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
{% block par_user_content %}
 | 
					{% block par_user_content %}
 | 
				
			||||||
 | 
					    <a class="btn-primary btn" href="{{ path('parameter_bundle_parameters', {category:'categories'}) }}">Back</a> <br><br>
 | 
				
			||||||
    {{ form(parameter_form) }}
 | 
					    {{ form(parameter_form) }}
 | 
				
			||||||
    {% include '@ArdentParameter/form.extra.html.twig' %}
 | 
					    {% include '@ArdentParameter/form.extra.html.twig' %}
 | 
				
			||||||
{% endblock %}
 | 
					{% endblock %}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user