Fix line endings?

This commit is contained in:
Tim 2021-07-21 00:25:37 +02:00
parent d20f7401c1
commit da8a1e37ca
4 changed files with 758 additions and 758 deletions

View File

@ -1,41 +1,41 @@
<?php <?php
namespace Ardent\ParameterBundle\Controller; namespace Ardent\ParameterBundle\Controller;
use Ardent\ParameterBundle\Service\ParameterService; use Ardent\ParameterBundle\Service\ParameterService;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
class ParameterController extends BaseController class ParameterController extends BaseController
{ {
/** /**
* @Route("/{category}", name="parameter_bundle_parameters") * @Route("/{category}", name="parameter_bundle_parameters")
*/ */
public function parameters($category = 'categories', 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 ('categories' === $category) { // List all the categories if ('categories' === $category) { // List all the categories
$categories = []; $categories = [];
foreach ($configs as $key => $config) { foreach ($configs as $key => $config) {
$categories[] = $key; $categories[] = $key;
} }
$categories[] = 'all'; $categories[] = 'all';
return $this->render('@ArdentParameter/categories.html.twig', ['categories' => $categories]); return $this->render('@ArdentParameter/categories.html.twig', ['categories' => $categories]);
} elseif ('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);
} }
return parent::baseIndex($param, $request, $allConfigs); return parent::baseIndex($param, $request, $allConfigs);
} else { // Show the parameters from one category } else { // Show the parameters from one category
return parent::baseIndex($param, $request, $configs[$category]); return parent::baseIndex($param, $request, $configs[$category]);
} }
} }
} }

View File

@ -1,38 +1,38 @@
<?php <?php
namespace Ardent\ParameterBundle\DependencyInjection; namespace Ardent\ParameterBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface; use Symfony\Component\Config\Definition\ConfigurationInterface;
class Configuration implements ConfigurationInterface class Configuration implements ConfigurationInterface
{ {
public const TYPE_TEXT = 'text'; public const TYPE_TEXT = 'text';
public const TYPE_NUMBER = 'number'; public const TYPE_NUMBER = 'number';
public function getConfigTreeBuilder() public function getConfigTreeBuilder()
{ {
$treeBuilder = new TreeBuilder('ardent_parameter'); $treeBuilder = new TreeBuilder('ardent_parameter');
$treeBuilder->getRootNode() $treeBuilder->getRootNode()
->children() ->children()
->arrayNode('parameters') ->arrayNode('parameters')
->arrayPrototype() ->arrayPrototype()
->arrayPrototype() ->arrayPrototype()
->children() ->children()
->scalarNode('name')->end() ->scalarNode('name')->end()
->enumNode('type') ->enumNode('type')
->values([self::TYPE_TEXT, self::TYPE_NUMBER]) ->values([self::TYPE_TEXT, self::TYPE_NUMBER])
->defaultValue(self::TYPE_TEXT) ->defaultValue(self::TYPE_TEXT)
->end() ->end()
->end() ->end()
->end() ->end()
->end() ->end()
->end() ->end()
->end(); ->end();
return $treeBuilder; return $treeBuilder;
} }
} }

1346
LICENSE

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,9 @@
{% extends '@ArdentParameter/layout.html.twig' %} {% extends '@ArdentParameter/layout.html.twig' %}
{% block par_user_content %} {% block par_user_content %}
<h2>Parameter categories</h2><br> <h2>Parameter categories</h2><br>
{% for category in categories %} {% for category in categories %}
<a class="btn-primary btn" href="{{ path('parameter_bundle_parameters', {category:category}) }}">{{ category }}</a><br><br> <a class="btn-primary btn" href="{{ path('parameter_bundle_parameters', {category:category}) }}">{{ category }}</a><br><br>
{% endfor %} {% endfor %}
{% endblock %} {% endblock %}