Skip to content

Commit

Permalink
Merge pull request #217 from ridho-laksono-lamudi/bugfix/avoid-member…
Browse files Browse the repository at this point in the history
…-state-for-repeater-field

avoid member state being set on repeater field
  • Loading branch information
bobdenotter authored May 29, 2022
2 parents bc2c16e + 7807985 commit 570991c
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/Storage/Legacy.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ public function getContentObject($contenttype, $values = [], $isRootType = true)
$prop = $reflection->getParentClass()->getProperty('app');
$prop->setAccessible(true);
$app = $prop->getValue($this);
$this->localeValues = $values;


$localeSlug = $app['translate.slug'];
if (isset($values[$localeSlug . 'data'])) {
$localeData = json_decode($values[$localeSlug . 'data'], true);
Expand All @@ -45,8 +44,8 @@ public function getContentObject($contenttype, $values = [], $isRootType = true)
} else {
$content = new Content($app, $contenttype, $values);
}
$content['originalValues'] = $this->localeValues;

$content['originalValues'] = $values;
return $content;
}

Expand Down Expand Up @@ -77,8 +76,8 @@ private function repeaterHydrate($record, $app)
$contentTypeName = $record->contenttype['slug'];

$contentType = $app['config']->get('contenttypes/' . $contentTypeName);
$values = $this->localeValues;

$values = $record;
$localeSlug = $app['translate.slug'];

if (isset($values[$localeSlug . 'data'])) {
Expand Down Expand Up @@ -114,7 +113,7 @@ private function repeaterHydrate($record, $app)
}
}

/**
/**
*Fix for field type blocks
*/
if (isset($contentType['fields'][$key]) && $contentType['fields'][$key]['type'] === 'block' && $value !== null) {
Expand Down

0 comments on commit 570991c

Please sign in to comment.