@@ -40,17 +40,38 @@ export default class PlaceholderInsertDropdown extends PureComponent {
40
40
} ;
41
41
42
42
render ( ) {
43
+ let options = [ ] ;
44
+
43
45
const [ formPath , workspace ] = parentNodeContextPath (
44
46
parentNodeContextPath ( this . props . focusedNode . contextPath )
45
47
) . split ( "@" ) ;
46
48
49
+ // get options of first page
47
50
const elementsPath = `${ formPath } /elements@${ workspace } ` ;
48
51
49
52
const elementsNode = this . props . nodesByContextPath [ elementsPath ] ;
50
53
if ( ! elementsNode ) {
51
54
return null ;
52
55
}
53
- const options = this . getOptionsRecursively ( elementsNode . children ) ;
56
+ const firstPageOptions = this . getOptionsRecursively ( elementsNode . children ) ;
57
+ if ( firstPageOptions && firstPageOptions . length > 0 ) {
58
+ options = options . concat ( firstPageOptions ) ;
59
+ }
60
+
61
+ // get options of further pages
62
+ const furtherPagesPath = `${ formPath } /furtherpages@${ workspace } ` ;
63
+ const furtherPagesNode = this . props . nodesByContextPath [ furtherPagesPath ] ;
64
+ if ( furtherPagesNode && furtherPagesNode . children && furtherPagesNode . children . length > 0 ) {
65
+ furtherPagesNode . children . forEach ( furtherPageChildren => {
66
+ if ( furtherPageChildren ) {
67
+ const pageOptions = this . getOptionsOfPage ( furtherPageChildren ) ;
68
+
69
+ if ( pageOptions && pageOptions . length > 0 ) {
70
+ options = options . concat ( pageOptions ) ;
71
+ }
72
+ }
73
+ } ) ;
74
+ }
54
75
55
76
if ( options . length === 0 ) {
56
77
return null ;
@@ -71,6 +92,17 @@ export default class PlaceholderInsertDropdown extends PureComponent {
71
92
) ;
72
93
}
73
94
95
+ getOptionsOfPage ( page ) {
96
+ const [ path , workspace ] = page . contextPath . split ( "@" ) ;
97
+ const elementsPath = `${ path } /elements@${ workspace } ` ;
98
+ const elementsNode = this . props . nodesByContextPath [ elementsPath ] ;
99
+ if ( ! elementsNode ) {
100
+ return null ;
101
+ }
102
+
103
+ return this . getOptionsRecursively ( elementsNode . children ) ;
104
+ }
105
+
74
106
getOptionsRecursively ( elements ) {
75
107
const { frontendConfiguration} = this . props ;
76
108
const ignoreNodeTypeInDropdown = frontendConfiguration . get ( 'Neos.Form.Builder:PlaceholderInsert' ) . ignoreNodeTypeInDropdown ;
0 commit comments