@@ -138,7 +138,7 @@ function outputItem($item) {
138
138
/**
139
139
* Outputs the markup for a single item.
140
140
* @param item : query row for a single nav item.
141
- * @returns output : string composed of HTML to be rendered
141
+ * @return output : string composed of HTML to be rendered
142
142
*/
143
143
144
144
$ output = '' ;
@@ -186,20 +186,32 @@ function renderDropdown($subItems) {
186
186
/**
187
187
* Takes subitems and returns markup.
188
188
* @param subItems : Query result containing nav items
189
- * @returns output : string composed of HTML to be rendered
189
+ * @return output : string composed of HTML to be rendered
190
190
*/
191
191
192
192
$ output = $ this ->_dropdown_open ;
193
193
194
194
foreach ($ subItems ->result () as $ item ) {
195
+ $ subOutput = $ this ->_item_open ;
196
+ $ classes = '' ;
195
197
196
198
// Check if current page and open item
197
199
if ($ this ->isCurrentPage ($ item ->ItemLink )) {
198
- $ output .= $ this ->_item_open_active ;
199
- } else {
200
- $ output .= $ this ->_item_open ;
200
+ $ classes .= $ this ->_item_open_active_class . ' ' ;
201
201
}
202
202
203
+ if (!is_null ($ subItems ) && count ($ subItems ->result ()) > 0 ){
204
+ // See if we have dropdown
205
+ $ classes .= $ this ->_item_open_dropdown_class . ' ' ;
206
+ }
207
+
208
+ if (!strcmp ($ classes ,'' ) == 0 ) {
209
+ // If classes to add them append to open tag
210
+ $ subOutput = str_replace ('> ' ,' class=" ' . $ classes . '"> ' ,$ subOutput );
211
+ }
212
+
213
+ $ output .= $ subOutput ;
214
+
203
215
// Output link
204
216
$ output .= $ this ->bindAnchor ($ item ->ItemLink , $ item ->ItemHumanName );
205
217
@@ -217,7 +229,7 @@ public function generateNav_fromName($menu_name)
217
229
/**
218
230
* Resolves a menu name to ID then returns the menu output.
219
231
* @param menu_name : string identifier of the menu as in CI-Nav-Menus
220
- * @returns output : string composed of HTML to be rendered.
232
+ * @return output : string composed of HTML to be rendered.
221
233
*/
222
234
$ menu_id = $ this ->CI ->nav ->getMenuID ($ menu_name );
223
235
return $ this ->generateNav_fromID ($ menu_id );
@@ -228,7 +240,7 @@ public function generateNav_fromID($menu_id) {
228
240
* Generates output for menu from a menu ID as specified in
229
241
* CI-Nav-Menus.
230
242
* @param menu_id : int ID of the menu to be generate
231
- * @returns output : string composed of HTML to be rendered.
243
+ * @return output : string composed of HTML to be rendered.
232
244
*/
233
245
234
246
// Open Container
@@ -253,7 +265,7 @@ public function generateNav_fromID($menu_id) {
253
265
public function generateRoleBasedNav () {
254
266
/**
255
267
* Outputs navigation selectively based on user authentication
256
- * @returns HTML markup for navigation
268
+ * @return HTML markup for navigation
257
269
*/
258
270
259
271
if (!$ this ->CI ->ion_auth ->logged_in ()){
0 commit comments