Commit ad479dd7 by Qiang Xue

Modified js registration position.

parent 51c29e44
......@@ -8,6 +8,7 @@
namespace yii\web;
use Yii;
use yii\base\View;
/**
* @author Qiang Xue <qiang.xue@gmail.com>
......@@ -29,12 +30,12 @@ class YiiAsset extends AssetBundle
public function registerAssets($view)
{
parent::registerAssets($view);
$js[] = "yii.version = '" . Yii::getVersion() . "';";
$js[] = "yii.version='" . Yii::getVersion() . "';";
$request = Yii::$app->getRequest();
if ($request instanceof Request && $request->enableCsrfValidation) {
$js[] = "yii.csrfVar = '{$request->csrfVar}';";
$js[] = "yii.csrfToken = '{$request->csrfToken}';";
$js[] = "yii.csrfVar='{$request->csrfVar}';";
$js[] = "yii.csrfToken='{$request->csrfToken}';";
}
$view->registerJs(implode("\n", $js));
$view->registerJs(implode("\n", $js), View::POS_END);
}
}
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