Skip to content

Commit 5cdf583

Browse files
committed
fixed label and indexes of fieldsets
1 parent bd5c71d commit 5cdf583

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

src/bootstrap/helpers.php

+21-15
Original file line numberDiff line numberDiff line change
@@ -173,20 +173,22 @@
173173

174174
//get the templates. This is needed and used
175175
//to create mutiple fieldsets on the fly
176-
$parent['name'] = $key;
177-
$parent['label'] = $label;
178176
$config = $getFormats([], 'field', $fieldset, [
179-
'name' => $parent['name'],
180-
'label' => $parent['label']
177+
'name' => $key,
178+
'label' => $label
181179
]);
182180

183181
//get the values
184182
$values = [];
185183

186184
if (!$multiple) {
187185
//resolve the label
188-
$values['label'] = $parent['label'];
189-
$values['rows'] = $getFormats($value, 'field', $fieldset, $parent);
186+
$values['label'] = $label;
187+
$values['rows'] = $getFormats($value, 'field', $fieldset, [
188+
'name' => $key,
189+
'label' => $label,
190+
'index' => $parent['index']
191+
]);
190192

191193
foreach($values['rows'] as $key2 => $row2) {
192194
//if there is a name template
@@ -203,25 +205,29 @@
203205
$parent['index'][] = $i;
204206

205207
//resolve the label
206-
$values[$i]['label'] = $parent['label'];
208+
$values[$i]['label'] = $label;
207209
foreach ($parent['index'] as $j => $index) {
208210
$values[$i]['label'] = str_replace(
209-
'{INDEX_' . $j . '}',
210-
$index + 1,
211+
'{INDEX_' . $j . '}',
212+
$index + 1,
211213
$values[$i]['label']
212214
);
213215
}
214216

215-
$values[$i]['rows'] = $getFormats($row, 'field', $fieldset, $parent);
217+
$values[$i]['rows'] = $getFormats($row, 'field', $fieldset, [
218+
'name' => $key,
219+
'label' => $label,
220+
'index' => $parent['index']
221+
]);
216222

217223
array_pop($parent['index']);
218224

219225
foreach($values[$i]['rows'] as $key2 => $row2) {
220226
//if there is a name template
221227
if (isset($row2['name'])) {
222228
$values[$i]['rows'][$key2]['name'] = str_replace(
223-
$indexPlaceholder2,
224-
$i,
229+
$indexPlaceholder2,
230+
$i,
225231
$row2['name']
226232
);
227233
//set the dot notation. this is for error handling
@@ -269,7 +275,7 @@
269275
$fieldset = Helpers::getFieldset(
270276
$fields[$name]['field']['parameters']
271277
)->getFields();
272-
278+
273279
//get the columns
274280
$columns = [];
275281
foreach($fieldset as $key => $field) {
@@ -306,11 +312,11 @@
306312
foreach($value as $index => $row) {
307313
//we should sort the rows based on column sorting
308314
$value[$index] = array_merge(
309-
array_flip(array_keys($columns)),
315+
array_flip(array_keys($columns)),
310316
$value[$index]
311317
);
312318

313-
$results = $getFormats($row, $type, $fieldset);
319+
$results = $getFormats($row, $type, $fieldset);
314320

315321
//on each value
316322
foreach($row as $index2 => $value2) {

0 commit comments

Comments
 (0)