Skip to content

Commit

Permalink
Merge pull request #14 from GigaGiorgadze/1.x
Browse files Browse the repository at this point in the history
fix: state path not applying to children schemas
  • Loading branch information
cklei-carly authored Sep 4, 2024
2 parents 8bce167 + d095b54 commit d74e1bc
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Forms/Component/Translate.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,6 @@ public function getChildComponentContainers(bool $withHidden = false): array

protected function prepareTranslateLocaleComponent(Component $component, string $locale): Component
{


$localeComponent = clone $component;

if( method_exists($localeComponent,'getName')){
Expand Down Expand Up @@ -278,6 +276,15 @@ protected function prepareTranslateLocaleComponent(Component $component, string
$localeComponent->name($component->getName().'.'.$locale);
$localeComponent->statePath($localeComponent->getName());
}
} else {
$childComponents = $localeComponent->getChildComponents();
if ($childComponents) {
$localeComponent->schema(
collect($childComponents)
->map(fn ($childComponent) => $this->prepareTranslateLocaleComponent($childComponent, $locale))
->all()
);
}
}

return $localeComponent;
Expand Down

0 comments on commit d74e1bc

Please sign in to comment.