/** * Returns a list of behaviors that this component should behave as. * * Child classes may override this method to specify the behaviors they want to behave as. * * The return value of this method should be an array of behavior objects or configurations * indexed by behavior names. A behavior configuration can be either a string specifying * the behavior class or an array of the following structure: * * ```php * 'behaviorName' => [ * 'class' => 'BehaviorClass', * 'property1' => 'value1', * 'property2' => 'value2', * ] * ``` * * Note that a behavior class must extend from [[Behavior]]. Behavior names can be strings * or integers. If the former, they uniquely identify the behaviors. If the latter, the corresponding * behaviors are anonymous and their properties and methods will NOT be made available via the component * (however, the behaviors can still respond to the component's events). * * Behaviors declared in this method will be attached to the component automatically (on demand). * * @return array the behavior configurations. */ public function behaviors() { $behaviors = ['verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['post']]]]; if (Module::hasUserRole()) { $behaviors['role'] = ['class' => \navatech\role\filters\RoleFilter::className(), 'name' => Translate::x_management([Translate::language()]), 'actions' => ['list' => Translate::lists(), 'create' => Translate::create(), 'update' => Translate::update(), 'delete' => Translate::delete()]]; } return $behaviors; }
/** * @inheritdoc */ public function behaviors() { $behaviors = ['verbs' => ['class' => VerbFilter::className(), 'actions' => ['delete' => ['POST']]], 'access' => ['class' => AccessControl::className(), 'rules' => [['allow' => true, 'roles' => ['@']]]]]; if (Module::hasUserRole()) { if (Module::hasMultiLanguage()) { return ArrayHelper::merge($behaviors, ['role' => ['class' => RoleFilter::className(), 'name' => Translate::setting(), 'actions' => ['index' => Translate::index(), 'create' => Translate::create(), 'update' => Translate::update(), 'delete' => Translate::delete()]]]); } else { return ArrayHelper::merge($behaviors, ['role' => ['class' => RoleFilter::className(), 'name' => 'Setting', 'actions' => ['index' => Yii::t('setting', 'List'), 'create' => Yii::t('setting', 'Create'), 'update' => Yii::t('setting', 'Update'), 'delete' => Yii::t('setting', 'Delete')]]]); } } else { return $behaviors; } }
<?php use navatech\language\models\Language; use navatech\language\Translate; use yii\web\View; /* @var $this View */ /* @var $model Language */ $this->params['breadcrumbs'][] = ['label' => Translate::language(), 'url' => ['list']]; $this->params['breadcrumbs'][] = Translate::update(); ?> <div class="navatech-language"> <div class="col-sm-12"> <div class="page-header"> <h1><?php echo Translate::language(); ?> <small> <i class="ace-icon fa fa-angle-double-right"></i> <?php echo Translate::update(); ?> </small> </h1> </div> <div class="space-6"></div> <?php echo $this->render('_form', ['model' => $model]); ?> </div> </div>