title: How to get the theme folder path of JuiAsset in Yii2?
body: <p>In the <a href="/questions/tagged/yii2-advanced-app" class="post-tag" title="show questions tagged &#39;yii2-advanced-app&#39;" rel="tag">yii2-advanced-app</a>, the jui assets are found in paths like: <code>web\assets\135efca3\</code> in which <code>themes</code> and <code>ui</code> folders are found -<em>Indeed, I don't know why Yii2 makes a varied path segment or fake path</em>-. I think that <a href="http://www.yiiframework.com/doc-2.0/yii-web-assetmanager.html#getAssetPath()-detail" rel="nofollow noreferrer"><strong>getAssetPath()</strong></a> method of assetManager should return that path, but I don't know how!</p>
  <p>I tried the following debugging code in the <code>actions()</code> method of the controller:</p>
  <pre><code>public function actions()
  {
     echo Yii::$app-&gt;assetManager-&gt;getAssetPath(Yii::$app-&gt;assetManager-&gt;bundles = [
            'yii\jui\JuiAsset'], 'themes');
            die(); //for debugging
  } 
  </code></pre>
  <p>However, it just prints <code>/themes</code>.</p>
  <p>In other words, I can ask, how could I able to supply the first parameter (object) of <code>getAssetPath()</code>? because, I think it is the problem here.</p>
  <h3>Edit</h3>
  <p>I have created the following helper -<em>according to arogachev answer about the path</em>- to get a list of themes.</p>
  <pre><code>&lt;?php
  namespace common\libs;
  use yii;
  use yii\web\Controller;
  
      class JuithemeHelpers
      {
        public static function getThemesList()
        {
          $themesPath =  dirname(Yii::$app-&gt;basePath).DIRECTORY_SEPARATOR.&quot;vendor&quot;.DIRECTORY_SEPARATOR.&quot;bower&quot;.DIRECTORY_SEPARATOR.&quot;jquery-ui&quot;.DIRECTORY_SEPARATOR.&quot;themes&quot;;
          $output = [];
          foreach (scandir($themesPath) as $item){
            if (is_dir($themesPath.DIRECTORY_SEPARATOR.$item) &amp;&amp; ($item != '.' &amp;&amp; $item !='..')) $output[] = $item;
          }
          return $output;
        }
      }
  </code></pre>
  <p>Then in the view I have made the following:</p>
  <pre><code>...
  &lt;?= $form-&gt;field($model, 'birthdate')-&gt;widget(DatePicker::className(), ['clientOptions' =&gt; ['dateFormat' =&gt; 'yy-mm-dd', 'changeYear' =&gt; true, 'yearRange' =&gt; sprintf('%s:%s', date('Y')-100,date('Y')-16)],]) ?&gt;
      
        &lt;select onchange=&quot;changeTheme(this.value)&quot;&gt;
        &lt;?php foreach (JuithemeHelpers::getThemesList() as $item): ?&gt;
                &lt;option value=&quot;&lt;?= $item ?&gt;&quot;&gt;&lt;?= $item ?&gt;&lt;/option&gt;
          &lt;?php       endforeach; ?&gt;
        &lt;/select&gt;
      
      
      &lt;?= $form-&gt;field($model, 'gender_id')-&gt;dropDownList($model-&gt;getGenderList(), ['prompt' =&gt; 'Please Select one...']) ?&gt;
  
  
    ...
  ......
  &lt;script&gt;
      function changeTheme(n){  
        s = document.getElementsByTagName('link');
        o = ''
        re = /\/themes\/(.*)\/jquery-ui.css/gi;
        for (i = 0; i &lt; s.length; i++){
          if (s[i].href.match(re)){
            
                  o = s[i].href.replace(re.exec(s[i].href)[1],n);
                  s[i].href=o;
          }       
        }
      }  
        &lt;/script&gt;
  </code></pre>
  <p>I think that now is the time to learn how to package all of this in a widget.</p>