Commit 9820dcef by Qiang Xue

Merge pull request #970 from cebe/929-fixes-debug-module-preload-view-conflict

fixes issue with debugmodule initializing view component too early
parents a1e6c16e cba8ec73
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace yii\debug; namespace yii\debug;
use Yii; use Yii;
use yii\base\Application;
use yii\base\View; use yii\base\View;
use yii\web\HttpException; use yii\web\HttpException;
...@@ -55,7 +56,11 @@ class Module extends \yii\base\Module ...@@ -55,7 +56,11 @@ class Module extends \yii\base\Module
parent::init(); parent::init();
$this->dataPath = Yii::getAlias($this->dataPath); $this->dataPath = Yii::getAlias($this->dataPath);
$this->logTarget = Yii::$app->getLog()->targets['debug'] = new LogTarget($this); $this->logTarget = Yii::$app->getLog()->targets['debug'] = new LogTarget($this);
Yii::$app->getView()->on(View::EVENT_END_BODY, array($this, 'renderToolbar')); // do not initialize view component before application is ready (needed when debug in preload)
$module = $this;
Yii::$app->on(Application::EVENT_BEFORE_ACTION, function() use ($module) {
Yii::$app->getView()->on(View::EVENT_END_BODY, array($module, 'renderToolbar'));
});
foreach (array_merge($this->corePanels(), $this->panels) as $id => $config) { foreach (array_merge($this->corePanels(), $this->panels) as $id => $config) {
$config['module'] = $this; $config['module'] = $this;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment