41 lines
1.4 KiB
PHP
41 lines
1.4 KiB
PHP
<?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,
|
|
ParameterService $param,
|
|
Request $request)
|
|
{
|
|
$configs = $param->getConfig();
|
|
|
|
// Handle all special cases for the name
|
|
/*if ('list' === $name) { // List all the categories
|
|
$routes = [];
|
|
foreach ($configs as $key => $config) {
|
|
$routes[] = ['route' => 'parameters', 'params' => ['name' => $key], 'title' => $key];
|
|
}
|
|
|
|
return $this->render('list.routes.twig', ['routes' => $routes]);
|
|
} else*/if ('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]);
|
|
}
|
|
}
|
|
} |