Fix line endings?
This commit is contained in:
parent
d20f7401c1
commit
da8a1e37ca
@ -1,41 +1,41 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Ardent\ParameterBundle\Controller;
|
||||
|
||||
|
||||
use Ardent\ParameterBundle\Service\ParameterService;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class ParameterController extends BaseController
|
||||
{
|
||||
/**
|
||||
* @Route("/{category}", name="parameter_bundle_parameters")
|
||||
*/
|
||||
public function parameters($category = 'categories',
|
||||
ParameterService $param,
|
||||
Request $request)
|
||||
{
|
||||
$configs = $param->getConfig();
|
||||
|
||||
// Handle all special cases for the name
|
||||
if ('categories' === $category) { // List all the categories
|
||||
$categories = [];
|
||||
foreach ($configs as $key => $config) {
|
||||
$categories[] = $key;
|
||||
}
|
||||
$categories[] = 'all';
|
||||
return $this->render('@ArdentParameter/categories.html.twig', ['categories' => $categories]);
|
||||
} elseif ('all' === $category) { // Show all parameters from all categories
|
||||
$allConfigs = [];
|
||||
foreach ($configs as $config) {
|
||||
$allConfigs = array_merge($allConfigs, $config);
|
||||
}
|
||||
|
||||
return parent::baseIndex($param, $request, $allConfigs);
|
||||
} else { // Show the parameters from one category
|
||||
return parent::baseIndex($param, $request, $configs[$category]);
|
||||
}
|
||||
}
|
||||
<?php
|
||||
|
||||
|
||||
namespace Ardent\ParameterBundle\Controller;
|
||||
|
||||
|
||||
use Ardent\ParameterBundle\Service\ParameterService;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class ParameterController extends BaseController
|
||||
{
|
||||
/**
|
||||
* @Route("/{category}", name="parameter_bundle_parameters")
|
||||
*/
|
||||
public function parameters($category = 'categories',
|
||||
ParameterService $param,
|
||||
Request $request)
|
||||
{
|
||||
$configs = $param->getConfig();
|
||||
|
||||
// Handle all special cases for the name
|
||||
if ('categories' === $category) { // List all the categories
|
||||
$categories = [];
|
||||
foreach ($configs as $key => $config) {
|
||||
$categories[] = $key;
|
||||
}
|
||||
$categories[] = 'all';
|
||||
return $this->render('@ArdentParameter/categories.html.twig', ['categories' => $categories]);
|
||||
} elseif ('all' === $category) { // Show all parameters from all categories
|
||||
$allConfigs = [];
|
||||
foreach ($configs as $config) {
|
||||
$allConfigs = array_merge($allConfigs, $config);
|
||||
}
|
||||
|
||||
return parent::baseIndex($param, $request, $allConfigs);
|
||||
} else { // Show the parameters from one category
|
||||
return parent::baseIndex($param, $request, $configs[$category]);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,38 +1,38 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Ardent\ParameterBundle\DependencyInjection;
|
||||
|
||||
|
||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||
|
||||
class Configuration implements ConfigurationInterface
|
||||
{
|
||||
public const TYPE_TEXT = 'text';
|
||||
public const TYPE_NUMBER = 'number';
|
||||
|
||||
public function getConfigTreeBuilder()
|
||||
{
|
||||
$treeBuilder = new TreeBuilder('ardent_parameter');
|
||||
|
||||
$treeBuilder->getRootNode()
|
||||
->children()
|
||||
->arrayNode('parameters')
|
||||
->arrayPrototype()
|
||||
->arrayPrototype()
|
||||
->children()
|
||||
->scalarNode('name')->end()
|
||||
->enumNode('type')
|
||||
->values([self::TYPE_TEXT, self::TYPE_NUMBER])
|
||||
->defaultValue(self::TYPE_TEXT)
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end();
|
||||
|
||||
return $treeBuilder;
|
||||
}
|
||||
<?php
|
||||
|
||||
|
||||
namespace Ardent\ParameterBundle\DependencyInjection;
|
||||
|
||||
|
||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||
|
||||
class Configuration implements ConfigurationInterface
|
||||
{
|
||||
public const TYPE_TEXT = 'text';
|
||||
public const TYPE_NUMBER = 'number';
|
||||
|
||||
public function getConfigTreeBuilder()
|
||||
{
|
||||
$treeBuilder = new TreeBuilder('ardent_parameter');
|
||||
|
||||
$treeBuilder->getRootNode()
|
||||
->children()
|
||||
->arrayNode('parameters')
|
||||
->arrayPrototype()
|
||||
->arrayPrototype()
|
||||
->children()
|
||||
->scalarNode('name')->end()
|
||||
->enumNode('type')
|
||||
->values([self::TYPE_TEXT, self::TYPE_NUMBER])
|
||||
->defaultValue(self::TYPE_TEXT)
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end();
|
||||
|
||||
return $treeBuilder;
|
||||
}
|
||||
}
|
@ -1,9 +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 %}
|
||||
{% 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 %}
|
Loading…
Reference in New Issue
Block a user