ModuleAdminController::beforeAction PHP Méthode

beforeAction() protected méthode

protected beforeAction ( $action )
    protected function beforeAction($action)
    {
        $this->assetPathAlias = 'application.modules.' . $this->getModule()->name . '.assets';
        $this->assetPath = Yii::app()->assetManager->getPublishedPathOfAlias($this->assetPathAlias);
        if (file_exists('protected/modules/' . $this->getModule()->name . '/assets/js/admin.js')) {
            Yii::app()->assetManager->registerScriptFile('js/admin.js', $this->assetPathAlias, 10);
        }
        if (file_exists('protected/modules/' . $this->getModule()->name . '/assets/css/admin.css')) {
            Yii::app()->assetManager->registerCssFile('css/admin.css', $this->assetPathAlias, 10);
        }
        Yii::app()->assetManager->registerCssFile('css/module.css', $this->assetPathAlias);
        return parent::beforeAction($action);
    }

Usage Example

 protected function beforeAction($action)
 {
     if (parent::beforeAction($action)) {
         Yii::app()->assetManager->registerScriptFile('js/jquery.jOrgChart.js', $this->assetPathAlias, 12);
         Yii::app()->assetManager->registerCssFile('css/jquery.jOrgChart.css', $this->assetPathAlias, 12);
         return true;
     }
 }
All Usage Examples Of ModuleAdminController::beforeAction
ModuleAdminController