File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 2
2
3
3
use light \swagger \SwaggerUIAsset ;
4
4
use yii \helpers \Json ;
5
+ use yii \web \View ;
5
6
6
7
$ bundle = SwaggerUIAsset::register ($ this );
7
8
79
80
80
81
<div id="swagger-ui"></div>
81
82
<?php $ this ->endBody () ?>
82
- <script>
83
+ <?php
84
+ $ oauthConfiguration = ($ oauthConfiguration ) ? Json::encode ($ oauthConfiguration ) : 'null ' ;
85
+ $ this ->registerJs (<<<JS
83
86
window.onload = function() {
84
87
// Build a system
85
- window.ui = SwaggerUIBundle(<?= $ configurations ?> );
86
- <?php if ($ oauthConfiguration) : ?>
87
- window.ui.initOAuth(<?= Json:: encode ( $ oauthConfiguration) ?> );
88
- <?php endif ; ?>
88
+ window.ui = SwaggerUIBundle( $ configurations);
89
+ if ( $ oauthConfiguration !== null) {
90
+ window.ui.initOAuth( $ oauthConfiguration);
91
+ }
89
92
}
90
- </script >
93
+ JS , View:: POS_END ); ? >
91
94
</body>
92
95
93
96
</html>
You can’t perform that action at this time.
0 commit comments