I’m facing a problem caused by cache, I have a widget that is inside a fragment cache, that widget must register some assets, but it failed when cache is used.
Example code:
if ($this->beginCache($cacheID, ['variations' => [Yii::$app->language]])){
/* Other stuff*/
echo \frontend\widgets\HomeFeaturedEvent::widget(['currentView' => $this]);
/* Other stuff*/
$this->endCache();
}
How can I run dynamically the requested widget?