File tree Expand file tree Collapse file tree
modules/@apostrophecms/page/ui/apos/logic Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212
1313### Fixes
1414
15+ * Exclude unknown page types from the page manager.
16+
1517## 4.19.0 (2025-07-09)
1618
1719### Adds
Original file line number Diff line number Diff line change @@ -397,6 +397,7 @@ export default {
397397 pageTree = pageTree . _children ;
398398 }
399399
400+ pageTree = filterValidPages ( pageTree ) ;
400401 formatPage ( pageTree ) ;
401402
402403 if ( ! pageTree . length && pageTree . length !== 0 ) {
@@ -415,13 +416,35 @@ export default {
415416 page . forEach ( formatPage ) ;
416417 return ;
417418 }
419+ if ( ! page . _id ) {
420+ return ;
421+ }
418422
419423 self . pagesFlat . push ( klona ( page ) ) ;
420424
421425 if ( Array . isArray ( page . _children ) ) {
422426 page . _children . forEach ( formatPage ) ;
423427 }
424428 }
429+
430+ function filterValidPages ( page ) {
431+ const result = { } ;
432+ if ( ! self . moduleOptions . validPageTypes . includes ( page . type ) ) {
433+ return result ;
434+ }
435+
436+ Object . assign ( result , page ) ;
437+
438+ result . _children = [ ] ;
439+ for ( const child of page . _children || [ ] ) {
440+ const filteredChild = filterValidPages ( child ) ;
441+ if ( filteredChild . _id ) {
442+ result . _children . push ( filteredChild ) ;
443+ }
444+ }
445+
446+ return result ;
447+ }
425448 } ,
426449 getAllPagesTotal ( ) {
427450 this . setAllPiecesSelection ( {
You can’t perform that action at this time.
0 commit comments