Download the PHP package itstructure/yii2-multi-level-menu without Composer
On this page you can find all versions of the php package itstructure/yii2-multi-level-menu. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download itstructure/yii2-multi-level-menu
More information about itstructure/yii2-multi-level-menu
Files in itstructure/yii2-multi-level-menu
Package yii2-multi-level-menu
Short Description Widget for rendering multilevel menu for Yii2 Framework
License MIT
Informations about the package yii2-multi-level-menu
Yii2 Multilevel menu widget
Introduction
This widget is designed to display a multilevel menu, in which there can be nested submenus. Used for Yii2 framework.
The widget uses data from the database, in which there are, in addition to the primary keys, also the parent keys.
Data from the database is taken from an active model, which instance of yii\db\ActiveRecord.
Requirements
- php >= 7.1
- composer
Installation
Via composer:
composer require itstructure/yii2-multi-level-menu ~3.2.9
Usage
Usage in view template
Base application config must be like in example below:
Example of itemTemplate
file:
Example when there are some properties for nesting levels:
Example when there are some properties as callable function:
Database table structure example
Table "pages"
| id | parentId | title | ... |
|-----|----------|------------|-----|
| 1 | NULL | item 1 | ... |
| 2 | NULL | item 2 | ... |
| 3 | NULL | item 3 | ... |
| 4 | NULL | item 4 | ... |
| 5 | NULL | item 5 | ... |
| 6 | 2 | item 2.1 | ... |
| 7 | 2 | item 2.2 | ... |
| 8 | 7 | item 2.2.1 | ... |
| 9 | 7 | item 2.2.2 | ... |
| 10 | 7 | item 2.2.3 | ... |
| ... | ... | ... | ... |
License
Copyright © 2018-2023 Andrey Girnik [email protected].
Licensed under the MIT license. See LICENSE.txt for details.