@@ -346,6 +346,7 @@ protected function gatherNavItems() {
346
346
$ b = array ("buckets " => array ()); // the array that will contain the items
347
347
$ bi = 0 ; // track the number for the bucket array
348
348
$ ni = 0 ; // track the number for the nav items array
349
+ $ incrementNavItem = true ; // track nav item regeneration so we avoid rebuilding view all pages
349
350
350
351
// iterate through each pattern type and add them as buckets
351
352
foreach ($ this ->patternTypes as $ patternType ) {
@@ -380,6 +381,12 @@ protected function gatherNavItems() {
380
381
381
382
}
382
383
384
+ // if all of the patterns for a given pattern type (e.g. atoms) were commented out we need to unset it
385
+ if (!isset ($ b ["buckets " ][$ bi ]["patternItems " ])) {
386
+ unset($ b ["buckets " ][$ bi ]);
387
+ $ bi --;
388
+ }
389
+
383
390
} else {
384
391
385
392
// iterate over pattern sub-types
@@ -413,6 +420,12 @@ protected function gatherNavItems() {
413
420
414
421
}
415
422
423
+ // if all of the patterns for a given sub-type were commented out we need to unset it
424
+ if (!isset ($ b ["buckets " ][$ bi ]["navItems " ][$ ni ]["navSubItems " ])) {
425
+ unset($ b ["buckets " ][$ bi ]["navItems " ][$ ni ]);
426
+ $ incrementNavItem = false ;
427
+ }
428
+
416
429
}
417
430
418
431
// add a view all for the section
@@ -428,7 +441,13 @@ protected function gatherNavItems() {
428
441
$ this ->viewAllPaths [$ vaBucket ][$ vaDirFinal ] = $ patternType ."- " .$ dirClean ;
429
442
}
430
443
431
- $ ni ++;
444
+ // this feels like such a hacky way of doing it
445
+ if (!$ incrementNavItem ) {
446
+ $ incrementNavItem = true ;
447
+ } else {
448
+ $ ni ++;
449
+ }
450
+
432
451
}
433
452
}
434
453
0 commit comments