carono / yii2-behaviors
Installs: 1 856
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- yiisoft/yii2: ^2.0
README
public function behaviors() { return [ 'urls' => [ 'class' => UrlBehavior::class, 'rules' => [ [ 'view-content', 'url' => function ($model, $params) { return $model->is_main ? ['/'] : ['/menu/view'] + $params; }, 'params' => ['id'] ], ['view', 'url' => ['/admin/menu/view'], 'params' => ['id'], 'role' => ['root']], ] ] ]; }
function getUrl($action, $asString = false)
$url = $model->getUrl('view'); // array ['/admin/menu/view','id'=>1]