Skip to content

Commit

Permalink
INIT
Browse files Browse the repository at this point in the history
  • Loading branch information
alexvenga committed Apr 12, 2023
1 parent 69a1b0d commit 1872963
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/Fields/Translatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,19 @@ public function exportViewValue(Model $item): string
public function formViewValue(Model $item): mixed
{

return collect($item->getTranslations($this->field()))
->toArray();
// TODO Переделать на SELECT

$array = $item->getTranslations($this->field());

if (!empty($this->requiredLanguagesCodes)) {
foreach ($this->requiredLanguagesCodes as $languagesCode) {
if (!isset($array[$languagesCode])) {
$array[$languagesCode] = null;
}
}
}

return $array;
}

/**
Expand Down

0 comments on commit 1872963

Please sign in to comment.