File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,9 @@ private function expandedSections(): array
110110 $ bufferedFields = [];
111111
112112 foreach ($ fields as $ field ) {
113- if (! $ this ->isSectionedFieldsetImport ($ field )) {
113+ $ importedFieldset = $ this ->sectionedFieldsetImport ($ field );
114+
115+ if (! $ importedFieldset ) {
114116 $ bufferedFields [] = $ field ;
115117
116118 continue ;
@@ -121,9 +123,7 @@ private function expandedSections(): array
121123 $ bufferedFields = [];
122124 }
123125
124- $ importedSections = FieldsetRepository::find ($ field ['import ' ])->sections ();
125-
126- foreach ($ importedSections as $ importedSection ) {
126+ foreach ($ importedFieldset ->sections () as $ importedSection ) {
127127 $ carry ->push ($ this ->toImportedPublishSection ($ importedSection , $ field ));
128128 }
129129 }
@@ -136,19 +136,19 @@ private function expandedSections(): array
136136 }, collect ())->all ();
137137 }
138138
139- private function isSectionedFieldsetImport (array $ field ): bool
139+ private function sectionedFieldsetImport (array $ field ): ? Fieldset
140140 {
141141 if (! isset ($ field ['import ' ])) {
142- return false ;
142+ return null ;
143143 }
144144
145145 if (($ field ['section_behavior ' ] ?? 'preserve ' ) === 'flatten ' ) {
146- return false ;
146+ return null ;
147147 }
148148
149149 $ fieldset = FieldsetRepository::find ($ field ['import ' ]);
150150
151- return $ fieldset && $ fieldset ->hasSections ();
151+ return $ fieldset && $ fieldset ->hasSections () ? $ fieldset : null ;
152152 }
153153
154154 private function toImportedPublishSection (array $ section , array $ import ): array
You can’t perform that action at this time.
0 commit comments