<?php
namespace ProjectBiz\MenuBundle;
use ProjectBiz\MenuBundle\Build\MenuHelperCompilerPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* A configurable menu system
*
* Configuration of the menu-system:
*
* Create a menu context (with an optional added global context):
* <pre>$myMenuContext = $this->menuHelper->beginMenuContext($globalContext, $primaryKey);</pre>
*
* The global context can be static or derived from route, query and request using the GlobalContextProvider
* service (projectbiz.portal.global_context_provider).
*
* Now you can get a concrete menu from the context using:
* <pre>$myMenu = $myMenuContext->getMenu($name, $context)</pre>
*
* $name can be a simple string or a NameResolverInterface. If it is a NameResolverInterface, the context is passed
* its resolve method to get the final menu name. This allows different menus based on context (e. g. different context
* menus based on object types.
*
* To show the menu use the menu-macro:
* <pre>{% import('ProjectBizPortalBundle::layout/menu/macro.menu-display.html.twig') as _menu %}</pre>
* and
* <pre>{{ _menu.show_menu(myMenu) }}</pre>
*
* Class ProjectBizMenuBundle
* @package ProjectBiz\MenuBundle
*/
class ProjectBizMenuBundle extends Bundle
{
public function build(ContainerBuilder $container)
{
parent::build($container);
$container->addCompilerPass(new MenuHelperCompilerPass());
}
}