@@ -80,50 +80,55 @@ public function init()
80
80
{
81
81
parent ::init ();
82
82
$ this ->clientOptions = false ;
83
+ $ html = [];
83
84
84
85
if (empty ($ this ->options ['role ' ])) {
85
86
$ this ->options ['role ' ] = 'navigation ' ;
86
87
}
87
88
88
89
if ($ this ->fixed ) {
89
90
Html::addCssClass ($ this ->fixedContainerOptions , 'navbar-fixed ' );
90
- echo Html::beginTag ('div ' , $ this ->fixedContainerOptions );
91
+ $ html [] = Html::beginTag ('div ' , $ this ->fixedContainerOptions );
91
92
}
92
93
93
- $ options = $ this ->options ;
94
- echo Html::beginTag ('nav ' , $ this ->options );
94
+ $ html [] = Html::beginTag ('nav ' , $ this ->options );
95
95
96
96
Html::addCssClass ($ this ->wrapperOptions , 'nav-wrapper ' );
97
- echo Html::beginTag ('div ' , $ this ->wrapperOptions );
97
+ $ html [] = Html::beginTag ('div ' , $ this ->wrapperOptions );
98
98
99
99
if ($ this ->brandLabel !== false ) {
100
100
Html::addCssClass ($ this ->brandOptions , ['widget ' => 'brand-logo ' ]);
101
- echo Html::a ($ this ->brandLabel , $ this ->brandUrl === false ? Yii::$ app ->homeUrl : $ this ->brandUrl , $ this ->brandOptions );
101
+ $ html [] = Html::a ($ this ->brandLabel , $ this ->brandUrl === false ? Yii::$ app ->homeUrl : $ this ->brandUrl , $ this ->brandOptions );
102
102
}
103
103
104
104
if (!isset ($ this ->containerOptions ['id ' ])) {
105
105
$ this ->containerOptions ['id ' ] = "{$ this ->id }-collapse " ;
106
106
}
107
- echo $ this ->renderToggleButton ();
108
- echo Html::beginTag ('div ' , $ this ->containerOptions );
107
+ $ html [] = $ this ->renderToggleButton ();
108
+ $ html [] = Html::beginTag ('div ' , $ this ->containerOptions );
109
+
110
+ echo implode ("\n" , $ html );
109
111
}
110
112
111
113
/**
112
114
* Renders the widget.
113
115
*/
114
116
public function run ()
115
117
{
116
- echo Html::endTag ('div ' ); // container
118
+ $ html = [];
119
+ $ html [] = Html::endTag ('div ' ); // container
117
120
118
- echo Html::endTag ('div ' ); // nav-wrapper
121
+ $ html [] = Html::endTag ('div ' ); // nav-wrapper
119
122
120
- echo Html::endTag ('nav ' );
123
+ $ html [] = Html::endTag ('nav ' );
121
124
122
125
if ($ this ->fixed ) {
123
- echo Html::endTag ('div ' );
126
+ $ html [] = Html::endTag ('div ' );
124
127
}
125
128
126
129
MaterializePluginAsset::register ($ this ->getView ());
130
+
131
+ return implode ("\n" , $ html );
127
132
}
128
133
129
134
/**
0 commit comments