title: Yii2 and Bundle Url
body: <p>How can I get bundle url in a view if it was registered on the layout not in the view itself?</p>
  
  <p>In the layout I have:</p>
  
  <pre><code>use yii\helpers\Html;
  use app\assets\LoginAsset;
  $bundle = LoginAsset::register($this);
  </code></pre>
  
  <p>And in the view I do:</p>
  
  <pre><code>&lt;?php
  use app\assets\LoginAsset;
  $bundle = LoginAsset::register($this);
  ?&gt;
  &lt;img src="&lt;?php echo $bundle-&gt;baseUrl; ?&gt;/img/avatar-sign.png" alt=""&gt;
  </code></pre>
  
  <p>But I want to avoid repeating bundle registration, other views use same layout but they do not need the bundle url.</p>
  
  <p>Any ideas?</p>