Menu menager for Yii2 ¶
Features ¶
- Creating and menagment navbar-left and/or navbar-right
- Sorting, editing, and deleting elements using drag and drop method
- CRUD operations by jQuery Ajax)
- No jQuery for drag and drop (RubaXa/Sortable)
Installation ¶
composer require pceuropa/yii2-menu dev-master
Add the following code to config file Yii2 (config/web.php or exp. config/main.php)
'modules' => [
'menu' => [
'class' => '\pceuropa\menu\Module',
],
]
Configuration ¶
1. Create database schema (table menu) ¶
Make sure that you have properly configured db
application component
and run the following command:
$ php yii migrate/up --migrationPath=@vendor/pceuropa/yii2-menu/migrations
2. Add the following code to config file Yii2 ¶
use pceuropa\menu\Menu;
NavBar::begin(['brandLabel' => 'Brand','brandUrl' => Url::home(),]);
echo Nav::widget([ 'options' => ['class' => 'navbar-nav navbar-left'],
'items' => Menu::NavbarLeft(1) // argument is id of menu
]);
echo Nav::widget([ 'options' => ['class' => 'navbar-nav navbar-right'],
'items' => Menu::NavbarRight(1)
]);
NavBar::end();
Author: Rafal Marguzewicz| Donation
Error in code.
Installed.. ran the migration, when I go to the /menu url I get the following php error
syntax error, unexpected '.', expecting ',' or ';'
in G:\webroot2\yii2app\advanced_protected\vendor\pceuropa\yii2-menu\MenuAsset.php at line 8
I looked at that line. It appears fins so something prior to that is bad.
Platform is Windows 10 / Apache 2 PHP 5.5 Yii2
in v2.0.7 fix this bug
All reported bugs fixed
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.