PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / trunk
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More vtrunk
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/helpers/FrmFieldGridHelper.php +27 -10 6.28 → trunk View file →
@@ -77,9 +77,9 @@
77 77 */
78 78 public function set_field( $field ) {
79 79 $this->field = $field;
80 80
81 - if ( ! empty( $this->section_helper ) && 'end_divider' !== $field->type ) {
81 + if ( $this->section_helper && 'end_divider' !== $field->type ) {
82 82 $this->section_helper->set_field( $field );
83 83 return;
84 84 }
85 85
@@ -92,9 +92,9 @@
92 92 $this->field_layout_class = $this->get_field_layout_class();
93 93 $this->active_field_size = self::get_size_of_class( $this->field_layout_class );
94 94 }
95 95
96 - if ( 'divider' !== $field->type || ! empty( $this->nested ) ) {
96 + if ( 'divider' !== $field->type || $this->nested ) {
97 97 return;
98 98 }
99 99
100 100 $this->section_size = $this->active_field_size;
@@ -105,9 +105,9 @@
105 105 /**
106 106 * @return void
107 107 */
108 108 private function maybe_close_section_helper() {
109 - if ( empty( $this->section_helper ) ) {
109 + if ( ! $this->section_helper ) {
110 110 return;
111 111 }
112 112 $this->section_helper->force_close_field_wrapper();
113 113 $this->section_helper = null;
@@ -124,11 +124,10 @@
124 124 }
125 125
126 126 $split = explode( ' ', $field['classes'] );
127 127 $this->is_frm_first = in_array( 'frm_first', $split, true );
128 - $classes = self::get_grid_classes();
129 128
130 - foreach ( $classes as $class ) {
129 + foreach ( self::get_grid_classes() as $class ) {
131 130 if ( in_array( $class, $split, true ) ) {
132 131 return $class;
133 132 }
134 133 }
@@ -147,9 +146,9 @@
147 146 if ( false === $this->parent_li && 'end_divider' !== $this->field->type ) {
148 147 $this->begin_field_wrapper();
149 148 }
150 149
151 - if ( ! empty( $this->section_helper ) && $this->section_is_open ) {
150 + if ( $this->section_helper && $this->section_is_open ) {
152 151 $this->section_helper->maybe_begin_field_wrapper();
153 152 }
154 153 }
155 154
@@ -156,12 +155,25 @@
156 155 /**
157 156 * @return bool
158 157 */
159 158 private function should_first_close_the_active_field_wrapper() {
160 - if ( false === $this->parent_li || ! empty( $this->section_helper ) ) {
159 + if ( false === $this->parent_li ) {
161 160 return false;
162 161 }
163 162
163 + /**
164 + * Fields that sit inside an open section are wrapped by that section's own helper, so the
165 + * row here is not theirs to close. set_field() opens the section helper for the section
166 + * field itself, one step ahead of this check, and section_is_open is not set until
167 + * sync_list_size() runs afterwards. Testing both is what keeps the section field subject to
168 + * the width check below rather than being treated as though it were already inside itself.
169 + *
170 + * @see https://github.com/Strategy11/formidable-pro/issues/3820
171 + */
172 + if ( $this->section_helper && $this->section_is_open ) {
173 + return false;
174 + }
175 +
164 176 if ( 'end_divider' === $this->field->type ) {
165 177 return false;
166 178 }
167 179
@@ -214,9 +226,9 @@
214 226 /**
215 227 * @return void
216 228 */
217 229 public function sync_list_size() {
218 - if ( empty( $this->field ) ) {
230 + if ( ! $this->field ) {
219 231 return;
220 232 }
221 233
222 234 if ( 'divider' === $this->field->type ) {
@@ -222,9 +234,9 @@
222 234 if ( 'divider' === $this->field->type ) {
223 235 $this->section_is_open = true;
224 236 }
225 237
226 - if ( ! empty( $this->section_helper ) ) {
238 + if ( $this->section_helper ) {
227 239 $this->section_helper->sync_list_size();
228 240
229 241 if ( 'end_divider' === $this->field->type ) {
230 242 $this->maybe_close_section_helper();
@@ -260,9 +272,14 @@
260 272 /**
261 273 * @return void
262 274 */
263 275 private function close_field_wrapper() {
264 - $this->maybe_close_section_helper();
276 + // Only an open section has a nested wrapper to close. A section helper that set_field() has
277 + // just created belongs to the section about to start, so closing this row must leave it alone.
278 + if ( $this->section_is_open ) {
279 + $this->maybe_close_section_helper();
280 + }
281 +
265 282 echo '</ul></li>';
266 283 $this->parent_li = false;
267 284 $this->current_list_size = 0;
268 285 $this->current_field_count = 0;