2012-11-05 33 views

回答

1

那么,你应该创建一个服务做到这一点。

//services.yml

services: 
    mopa_bootstrap.example.navbar: 
     class: %mopa_bootstrap.navbar.generic% 
     arguments: 
      # first argument: a named array of menues: 
      - { leftmenu: @mopa_bootstrap.examplemenu=, rightmenu: @mopa_bootstrap.exampledropdown= } 
      # second argument: a named array of FormType Classes 
      - { searchform: Mopa\Bundle\BootstrapSandboxBundle\Form\Type\ExampleSearchFormType } 
      # third argument: a named array of options 
      - { title: "BootstrapSandbox", titleRoute: "mopa_bootstrap_welcome", fixedTop: true, isFluid: false, inverse: true } 
     tags: 
      # The alias is used to retrieve the navbar in templates 
      - { name: mopa_bootstrap.navbar, alias: sandboxFrontendNavbar } 

你可以看到第三个参数的逆选择。

FYI: https://github.com/phiamo/MopaBootstrapSandboxBundle/blob/master/Resources/config/examples/example_navbar.yml