php - use custom function in assetmanager -


how use yii::$app->session['somename'] in yii2 assetmanager?

how make access function in assetmanager?

class appasset extends assetbundle{ public function getlang() {   $currentlang = yii::$app->session['lang'];     if ($currentlang == 'fa' || $currentlang == 'ar') {         return 'rtl';     } else {         return 'ltr';     } } public $lang;  public $basepath = '@webroot'; public $baseurl = '@web'; public $css = [     'css/iconsprite.min.css',      // how call getlang here  ] 

how call getlang in css part?

you can this

.. other functions  public function init() {     $this->setupassets();     parent::init(); }  protected function setupassets() {     $lang = $this->getlang();     $this->css[] = "css/myfile.$lang.css"; } 

Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -