Skip to content

Commit

Permalink
Fix copy translation (terminal42#63)
Browse files Browse the repository at this point in the history
* Fix copy translation

Non translated field may not use values of fallback language. Use default value defined in the dca or the sql default instead
  • Loading branch information
dmolineus authored May 7, 2020
1 parent f43270e commit df8fe5b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -604,9 +604,15 @@ public function copy($blnDoNotRedirect = false)
$set = $this->set;

foreach ($objTranslations->row() as $k => $v) {
if (in_array($k, array_keys($GLOBALS['TL_DCA'][$this->strTable]['fields']))
&& $GLOBALS['TL_DCA'][$this->strTable]['fields'][$k]['eval']['translatableFor'] != ''
) {
if (array_key_exists($k, $GLOBALS['TL_DCA'][$this->strTable]['fields'])) {
if (!$GLOBALS['TL_DCA'][$this->strTable]['fields'][$k]['eval']['translatableFor']) {
if (isset($GLOBALS['TL_DCA'][$this->strTable]['fields'][$k]['default'])) {
$set[$k] = $GLOBALS['TL_DCA'][$this->strTable]['fields'][$k]['default'];
} else {
unset($set[$k]);
}
continue;
}
// Empty unique fields or add a unique identifier in copyAll mode
if ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$k]['eval']['unique']) {
if (\Input::get('act') == 'copyAll') {
Expand Down

0 comments on commit df8fe5b

Please sign in to comment.