PHP code example of disjfa / menu-bundle
1. Go to this page and download the library: Download disjfa/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/ */
disjfa / menu-bundle example snippets
namespace App\Menu;
use Disjfa\MenuBundle\Menu\ConfigureSiteMenu;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class MenuListener implements EventSubscriberInterface
{
public function onMenuConfigure(ConfigureSiteMenu $event)
{
$menu = $event->getMenu();
$menu->addChild('my_route', [
'route' => 'my_route',
'label' => 'My route title',
])->setExtra('icon', 'fa-home');
}
/**
* @return array
*/
public static function getSubscribedEvents()
{
return [
ConfigureSiteMenu::class => ['onMenuConfigure', 999]
];
}
}