mirror of
https://github.com/humhub/humhub.git
synced 2025-01-16 21:58:17 +01:00
Fix module JS config initialisation on AJAX request (#7225)
This commit is contained in:
parent
a4a4293da3
commit
acddf8736c
@ -9,6 +9,7 @@ HumHub Changelog
|
||||
- Fix #7219: Renamed deprecated meta tag
|
||||
- Fix #7174: In lists, when an item text is displayed on multiple lines, the lines below are not lining up with the first one
|
||||
- Fix #7222: Fix rendering of checkbox on MacOS and iOS
|
||||
- Fix #7225: Fix module JS config initialisation on AJAX request
|
||||
|
||||
1.16.2 (September 5, 2024)
|
||||
--------------------------
|
||||
|
@ -521,7 +521,15 @@ class View extends \yii\web\View
|
||||
protected function flushJsConfig($key = null)
|
||||
{
|
||||
if (!empty($this->jsConfig)) {
|
||||
$this->registerJs("humhub.config.set(" . json_encode($this->jsConfig) . ");", View::POS_BEGIN, $key);
|
||||
$jsConfig = 'humhub.config.set(' . json_encode($this->jsConfig) . ')';
|
||||
if (Yii::$app->request->isAjax) {
|
||||
// This fix is required only on AJAX request!
|
||||
// Put JS config code into the "jsFiles" array, in order to call it before
|
||||
// the module JS file where the config must be already initialised.
|
||||
$this->jsFiles[self::POS_HEAD][$key ?: md5($jsConfig)] = Html::script($jsConfig);
|
||||
} else {
|
||||
$this->registerJs($jsConfig, self::POS_BEGIN, $key);
|
||||
}
|
||||
$this->jsConfig = [];
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user