1. Go to this page and download the library: Download baconmanager/menu-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
baconmanager / menu-bundle example snippets
// app/AppKernel.php
public function registerBundles()
{
// ...
new Knp\Bundle\MenuBundle\KnpMenuBundle(),
new Bacon\Bundle\MenuBundle\BaconMenuBundle(),
// ...
}
// src/AppBundle/Menu/Builder.php
namespace AppBundle\Menu;
use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
class Builder extends ContainerAware
{
public function addMenu(FactoryInterface $factory, array $options)
{
$menu = $factory->createItem('root');
$translate = $this->container->get('translator');
// Menu Catalog
$menu->addChild($translate->trans('Category'))->setAttribute('icon', '<i class="fa fa-book"></i>');
$menu[$translate->trans('Category')]->addChild($translate->trans('List'),array('route' => 'admin_category'));
$menu[$translate->trans('Category')]->addChild($translate->trans('New'),array('route' => 'admin_category_new'));
return $menu;
}
}
// src/AppBundle/Menu/Builder.php
namespace AppBundle\Menu;
use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
class Builder implements ContainerAwareInterface
{
use ContainerAwareTrait;
public function addMenu(FactoryInterface $factory, array $options)
{
$menu = $factory->createItem('root');
$translate = $this->container->get('translator');
// Menu Catalog
$menu->addChild($translate->trans('Category'))->setAttribute('icon', '<i class="fa fa-book"></i>');
$menu[$translate->trans('Category')]->addChild($translate->trans('List'),array('route' => 'admin_category'));
$menu[$translate->trans('Category')]->addChild($translate->trans('New'),array('route' => 'admin_category_new'));
return $menu;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.