Retain true backward compatibility with early repeater
This commit is contained in:
parent
d7ef8cdcf8
commit
cb56c61e36
|
|
@ -151,7 +151,7 @@ class Repeater extends FormWidgetBase
|
|||
*/
|
||||
protected function processSaveValue($value)
|
||||
{
|
||||
if (!is_array($value) || !$value) {
|
||||
if (!$this->useGroups || !is_array($value) || !$value) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
|
@ -172,8 +172,8 @@ class Repeater extends FormWidgetBase
|
|||
protected function processExistingItems()
|
||||
{
|
||||
$loadedIndexes = $loadedGroups = [];
|
||||
|
||||
$loadValue = $this->getLoadValue();
|
||||
|
||||
if (is_array($loadValue)) {
|
||||
foreach ($loadValue as $index => $loadedValue) {
|
||||
$loadedIndexes[] = array_get($loadedValue, '_index', $index);
|
||||
|
|
@ -235,10 +235,14 @@ class Repeater extends FormWidgetBase
|
|||
protected function getLoadValueFromIndex($index)
|
||||
{
|
||||
if (is_array($loadValue = $this->getLoadValue())) {
|
||||
foreach ($loadValue as $data) {
|
||||
foreach ($loadValue as $_index => $data) {
|
||||
if (array_get($data, '_index') == $index) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
if ($_index == $index) {
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue