cinghie/yii2-menu

Yii2 Menu to create, manage, and delete dynamic menus in a Yii2 site.

Installs: 1 005

Dependents: 0

Suggesters: 0

Security: 0

Stars: 10

Watchers: 5

Forks: 7

Open Issues: 2

Type:yii2-extension

0.9.6 2019-11-22 22:15 UTC

This package is auto-updated.

Last update: 2024-11-08 12:21:23 UTC


README

License Latest Stable Version Latest Release Date Latest Commit Total Downloads

Yii2 Menu to create, manage, and delete menù in a Yii2 site

Installation

The preferred way to install this extension is through composer.

Either run

$ php composer.phar require cinghie/yii2-menu "*"

or add

"cinghie/yii2-menu": "*"

Configuration

1. Update yii2 menu database schema

Make sure that you have properly configured db application component and run the following command:

$ php yii migrate/up --migrationPath=@vendor/cinghie/yii2-menu/migrations

2. Install Yii2 Multilanguage

https://github.com/cinghie/yii2-multilanguage

3. Set configuration file

Set on your configuration file

'modules' => [ 

	// Yii2 Menu
	'menu' => [
		'class' => 'cinghie\menu\Menu',
		'menuRoles' => ['admin'],
	],
	
]	

Overrides

Override controller example, on modules config

'modules' => [ 

	'menu' => [
		'class' => 'cinghie\menu\Menu',
		'controllerMap' => [
			'items' => 'app\controllers\ItemsController',
			'types' => 'app\controllers\TypesController',
		]
	]
	
],

Override models example, on modules config

'modules' => [ 

	'menu' => [
		'class' => 'cinghie\menu\Menu',
		'modelMap' => [
			'Items' => 'app\models\menu\Items',
			'Types' => 'app\models\menu\Types',
		]
	]
	
],

Override view example, on components config

'components' => [ 

	'view' => [
		'theme' => [
			'pathMap' => [
				'@cinghie/menu/views/items' => '@app/views/menu/items',
				'@cinghie/menu/views/types' => '@app/views/menu/types',
			],
		],
	],
	
],

URLS

  • Menù Types: PathToApp/index.php?r=menu/types/index
  • Menù Types with Pretty Urls: PathToApp/menu/types/index
  • Menù Items: PathToApp/index.php?r=menu/items/index
  • Menù Items with Pretty Urls: PathToApp/menu/items/index