Download the PHP package yidas/yii2-nav-locator without Composer
On this page you can find all versions of the php package yidas/yii2-nav-locator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yidas/yii2-nav-locator
More information about yidas/yii2-nav-locator
Files in yidas/yii2-nav-locator
Package yii2-nav-locator
Short Description Yii 2 Navigation Routing Locator for active menu identification
License MIT
Homepage https://github.com/yidas/yii2-locator
Informations about the package yii2-nav-locator
Yii 2 Navigation Locator
Yii 2 Navigation Routing Locator for active menu identification
FEATURES
-
Smartly identifying active navigation on current controller action
-
Multi-validators for grouping active navigation
- Route prefix setting support
OUTLINE
- Demonstration
- Requirements
- Installation
- Usage
- is()
- in()
- setPrefix()
DEMONSTRATION
Giving a 3-layer controller action route structure for Yii 2 framework:
In the view of global navigation menu, write active conditions by Nav Locator:
- Example 1 active URI:
data/list
,data/list/action
- Example 2 active URI:
data/structure-setting
,data/structure-setting/action
- Example 3 active URI:
datacenters/list
,datacenters/list/action
- Example 4 active URI:
datacenters/cluster-setting
,datacenters/cluster-setting/action
Nav Locator even supports route rule mapping. If you have a rule 'test' => 'data/list'
, the Nav Locator could identify as in data/list
when you enter with test
route.
REQUIREMENTS
This library requires the following:
- PHP 5.4.0+
- Yii 2.0.0+
INSTALLATION
Install via Composer in your Yii2 project:
USAGE
is()
Validate current controller action is completely matched giving route
Example:
Suppose site/index
as the current controller action:
The giving route need to be defined precisely, the format is
module-ID/controller-ID/action-ID
.
in()
Validate current controller action is under giving route
Example:
Suppose site/index
as the current controller action:
The giving route will divide into independent and precise route layers by each separator, letting you distinguish whether the current controller action belongs to the parent navigation.
setPrefix()
Set prefix route for simplifying declaring next locator routes
Example:
You could call it without parameter for reset prefix:
\yidas\NavLocator::setPrefix()