Boostrap Menu builder for Yii2 Framework

Features

  • To the menu, can add links, dropmenu and lines
  • Drag end drop - edit, move, delete items
  • Ajax - creating menu without refresh page
  • Many menus (eg. different languages), stored in the database
  • Embedding in the application using the method with the integer parameter
  • Demo bootstrap menu builder

Installation menu builder

composer require pceuropa/yii2-menu dev-master
Integration module with Yii2: add the following code to config file /common/config/main.php or /app/config/web.php
'modules' => [
    'menu' => [
            'class' => '\pceuropa\menu\Menu',
        ],
    ]

Create database table schema

php yii migrate/up --migrationPath=@vendor/pceuropa/yii2-menu/migrations
You can create a menu...

Creating a menu

If the installation module was successful, menu builder should be available at example.com/menu/creator
After saving a menu in database, remember ID number

Integration menu with the application frontend (or backend)

app/views/layout/main.php
use pceuropa\menu\Menu;
// Menu::NavbarLeft($id) return array

NavBar::begin(['brandLabel' => 'Brand', 'brandUrl' => Url::home()]);
echo Nav::widget([ 
		'items' => Menu::NavbarLeft(1),  // param is id of menu
		'options' => ['class' => 'navbar-nav navbar-left']
	]); 

echo Nav::widget([ 
                    'items' => Menu::NavbarRight(1),
                    'options' => ['class' => 'navbar-nav navbar-right'],
                ]);
NavBar::end();

Comments

Stars Follow @pceuropa

Create forms you bored?
Donate:
Bitcoin Cash (BCH): 1LUWCNvAnFbkz8ZMYtmMsnHHpqggGjVoww
Litecoin (LTC): LL3NNcJNs9QdGCft1TKFX1gKEic3kSUc3w