Skip to content

Instantly share code, notes, and snippets.

@sergeylunev
Created August 25, 2013 16:28
Show Gist options
  • Save sergeylunev/6334789 to your computer and use it in GitHub Desktop.
Save sergeylunev/6334789 to your computer and use it in GitHub Desktop.
Symfony2 - Knp Menu Builder Class
<?php
namespace App\AppBundle\Menu;
use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
class Builder extends ContainerAware
{
public function mainMenu(FactoryInterface $factory, array $options)
{
$menu = $factory->createItem('root');
$menu->addChild('Home', array('route' => 'homepage'));
return $menu;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment