vendor\project-biz\menu-bundle\src\ProjectBizMenuBundle.php line 35

Open in your IDE?
  1. <?php
  2. namespace ProjectBiz\MenuBundle;
  3. use ProjectBiz\MenuBundle\Build\MenuHelperCompilerPass;
  4. use Symfony\Component\DependencyInjection\ContainerBuilder;
  5. use Symfony\Component\HttpKernel\Bundle\Bundle;
  6. /**
  7.  * A configurable menu system
  8.  *
  9.  * Configuration of the menu-system:
  10.  *
  11.  * Create a menu context (with an optional added global context):
  12.  * <pre>$myMenuContext = $this->menuHelper->beginMenuContext($globalContext, $primaryKey);</pre>
  13.  *
  14.  * The global context can be static or derived from route, query and request using the GlobalContextProvider
  15.  * service (projectbiz.portal.global_context_provider).
  16.  *
  17.  * Now you can get a concrete menu from the context using:
  18.  * <pre>$myMenu = $myMenuContext->getMenu($name, $context)</pre>
  19.  *
  20.  * $name can be a simple string or a NameResolverInterface. If it is a NameResolverInterface, the context is passed
  21.  * its resolve method to get the final menu name. This allows different menus based on context (e. g. different context
  22.  * menus based on object types.
  23.  *
  24.  * To show the menu use the menu-macro:
  25.  * <pre>{% import('ProjectBizPortalBundle::layout/menu/macro.menu-display.html.twig') as _menu %}</pre>
  26.  * and
  27.  * <pre>{{ _menu.show_menu(myMenu) }}</pre>
  28.  *
  29.  * Class ProjectBizMenuBundle
  30.  * @package ProjectBiz\MenuBundle
  31.  */
  32. class ProjectBizMenuBundle extends Bundle
  33. {
  34.     public function build(ContainerBuilder $container)
  35.     {
  36.         parent::build($container);
  37.         $container->addCompilerPass(new MenuHelperCompilerPass());
  38.     }
  39. }