@@ -258,9 +258,7 @@ protected function processSaveValue($value)
258
258
*/
259
259
protected function processItems ()
260
260
{
261
- $ currentValue = ($ this ->loaded === true )
262
- ? post ($ this ->formField ->getName ())
263
- : $ this ->getLoadValue ();
261
+ $ currentValue = $ this ->getLoadValue ();
264
262
265
263
// Detect when a child widget is trying to run an AJAX handler
266
264
// outside of the form element that contains all the repeater
@@ -344,15 +342,18 @@ protected function makeItemFormWidget($index = 0, $groupCode = null)
344
342
return $ this ->formWidgets [$ index ] = $ widget ;
345
343
}
346
344
345
+ public function getLoadValue ()
346
+ {
347
+ return ($ this ->loaded === true ) ? post ($ this ->formField ->getName ()) : parent ::getLoadValue ();
348
+ }
349
+
347
350
/**
348
351
* Returns the data at a given index.
349
352
* @param int $index
350
353
*/
351
354
protected function getValueFromIndex ($ index )
352
355
{
353
- $ value = ($ this ->loaded === true )
354
- ? post ($ this ->formField ->getName ())
355
- : $ this ->getLoadValue ();
356
+ $ value = $ this ->getLoadValue ();
356
357
357
358
if (!is_array ($ value )) {
358
359
$ value = [];
@@ -406,18 +407,10 @@ public function onRefresh()
406
407
*/
407
408
protected function getNextIndex ()
408
409
{
409
- if ($ this ->loaded === true ) {
410
- $ data = post ($ this ->formField ->getName ());
410
+ $ data = $ this ->getLoadValue ();
411
411
412
- if (is_array ($ data ) && count ($ data )) {
413
- return (max (array_keys ($ data )) + 1 );
414
- }
415
- } else {
416
- $ data = $ this ->getLoadValue ();
417
-
418
- if (is_array ($ data )) {
419
- return count ($ data );
420
- }
412
+ if (is_array ($ data )) {
413
+ return count ($ data );
421
414
}
422
415
423
416
return 0 ;
0 commit comments