mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-24 08:33:49 +00:00
adapt layout for person search + standard rendering
This commit is contained in:
41
DependencyInjection/Services/MenuComposer.php
Normal file
41
DependencyInjection/Services/MenuComposer.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace CL\Chill\MainBundle\DependencyInjection\Services;
|
||||
|
||||
use Symfony\Component\Routing\RouterInterface;
|
||||
|
||||
/**
|
||||
* This class permit to build menu from the routing information
|
||||
* stored in each bundle.
|
||||
*
|
||||
* how to must come here FIXME
|
||||
*
|
||||
* @author julien
|
||||
*/
|
||||
class MenuComposer {
|
||||
|
||||
/**
|
||||
*
|
||||
* @var \Symfony\Component\Routing\RouteCollection;
|
||||
*/
|
||||
private $routeCollection;
|
||||
|
||||
|
||||
public function __construct(RouterInterface $router) {
|
||||
$this->routeCollection = $router->getRouteCollection();
|
||||
}
|
||||
|
||||
public function getRoutesFor($menuId, array $parameters = array()) {
|
||||
$routes = array();
|
||||
|
||||
foreach ($this->routeCollection->all() as $key => $route) {
|
||||
if ($route['options']['menu'] === $menuId) {
|
||||
$routes[$route['options']['order']] = $route;
|
||||
}
|
||||
}
|
||||
|
||||
return $routes;
|
||||
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user