@@ -104,29 +104,6 @@ public function create($brand, $options = []) {
104104 $ options = $ this ->addClass ($ options , 'navbar-static-top ' );
105105 }
106106
107- $ toggleButton = '' ;
108- $ rightOpen = '' ;
109- if ($ this ->_responsive ) {
110- $ toggleButton = $ this ->Html ->tag (
111- 'button ' ,
112- implode ('' , array (
113- $ this ->Html ->tag ('span ' , __ ('Toggle navigation ' ),
114- array ('class ' => 'sr-only ' )),
115- $ this ->Html ->tag ('span ' , '' , array ('class ' => 'icon-bar ' )),
116- $ this ->Html ->tag ('span ' , '' , array ('class ' => 'icon-bar ' )),
117- $ this ->Html ->tag ('span ' , '' , array ('class ' => 'icon-bar ' ))
118- )),
119- array (
120- 'type ' => 'button ' ,
121- 'class ' => 'navbar-toggle collapsed ' ,
122- 'data-toggle ' => 'collapse ' ,
123- 'data-target ' => '.navbar-collapse '
124- )
125- );
126- $ rightOpen = $ this ->Html ->tag (
127- 'div ' , null , ['class ' => 'navbar-collapse collapse ' ]);
128- }
129-
130107 if ($ brand ) {
131108 if (is_string ($ brand )) {
132109 $ brand = $ this ->Html ->link ($ brand , '/ ' , [
@@ -141,10 +118,39 @@ public function create($brand, $options = []) {
141118 $ brand ['options ' ] = $ this ->addClass ($ brand ['options ' ], 'navbar-brand ' );
142119 $ brand = $ this ->Html ->link ($ brand ['name ' ], $ brand ['url ' ], $ brand ['options ' ]);
143120 }
121+ }
122+
123+ $ toggleButton = '' ;
124+ if ($ this ->_responsive ) {
125+ $ toggleButton = $ this ->Html ->tag (
126+ 'button ' , implode ('' , [
127+ $ this ->Html ->tag ('span ' , __ ('Toggle navigation ' ),
128+ ['class ' => 'sr-only ' ]),
129+ $ this ->Html ->tag ('span ' , '' , ['class ' => 'icon-bar ' ]),
130+ $ this ->Html ->tag ('span ' , '' , ['class ' => 'icon-bar ' ]),
131+ $ this ->Html ->tag ('span ' , '' , ['class ' => 'icon-bar ' ])
132+ ]), [
133+ 'type ' => 'button ' ,
134+ 'class ' => 'navbar-toggle collapsed ' ,
135+ 'data-toggle ' => 'collapse ' ,
136+ 'data-target ' => '.navbar-collapse ' ,
137+ 'aria-expanded ' => 'false '
138+ ]);
139+ }
140+
141+ $ rightOpen = '' ;
142+ if ($ this ->_responsive || $ brand ) {
144143 $ rightOpen = $ this ->Html ->tag ('div ' , $ toggleButton .$ brand ,
145- ['class ' => 'navbar-header ' ]).$ rightOpen ;
144+ ['class ' => 'navbar-header ' ]);
145+ }
146+
147+ if ($ this ->_responsive ) {
148+ $ rightOpen .= $ this ->Html ->tag ('div ' , null , [
149+ 'class ' => 'collapse navbar-collapse '
150+ ]);
146151 }
147152
153+
148154 /** Add and return outer div openning. **/
149155 return $ this ->Html ->tag ('nav ' , null , $ options )
150156 .$ this ->Html ->tag ('div ' , null , [
0 commit comments