Skip to content

Commit

Permalink
put all elements into the array then implode
Browse files Browse the repository at this point in the history
  • Loading branch information
mjauvin committed Feb 20, 2024
1 parent faef2c3 commit 2e30b7e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions formwidgets/MLRepeater.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class MLRepeater extends Repeater
protected $defaultAlias = 'mlrepeater';

protected $translateFields = false;

/**
* {@inheritDoc}
*/
Expand All @@ -41,11 +42,13 @@ public function init()
$names = HtmlHelper::nameToArray($key);
array_shift($names); // remove model

$array = array_shift($names);
$arrayName = array_shift($names);
$field = array_pop($names);

if ($array && $field && $names) {
return array_get($this->{$array}, implode('.', $names) . '.locale' . ucfirst($field) . '.' . $locale);
if ($arrayName && $field) {
$names[] = 'locale' . ucfirst($field);
$names[] = $locale;
return array_get($this->{$arrayName}, implode('.', $names));
}
});
});
Expand Down

0 comments on commit 2e30b7e

Please sign in to comment.