2 namespace TYPO3\CMS\Backend\Form\FormDataProvider;
21 use TYPO3\CMS\Backend\Form\Exception\DatabaseDefaultLanguageException;
37 public function addData(array $result)
39 if (!empty($result[
'processedTca'][
'ctrl'][
'languageField'])
40 && !empty($result[
'processedTca'][
'ctrl'][
'transOrigPointerField'])
42 $languageField = $result[
'processedTca'][
'ctrl'][
'languageField'];
43 $fieldWithUidOfDefaultRecord = $result[
'processedTca'][
'ctrl'][
'transOrigPointerField'];
45 if (isset($result[
'databaseRow'][$languageField]) && $result[
'databaseRow'][$languageField] > 0
46 && isset($result[
'databaseRow'][$fieldWithUidOfDefaultRecord]) && $result[
'databaseRow'][$fieldWithUidOfDefaultRecord] > 0
49 $tableNameWithDefaultRecords = $result[
'tableName'];
50 if (!empty($result[
'processedTca'][
'ctrl'][
'transOrigPointerTable'])) {
51 $tableNameWithDefaultRecords = $result[
'processedTca'][
'ctrl'][
'transOrigPointerTable'];
56 $tableNameWithDefaultRecords,
57 (
int)$result[
'databaseRow'][$fieldWithUidOfDefaultRecord]
59 if (!is_array($defaultLanguageRow)) {
61 'Default language record with id ' . (
int)$result[
'databaseRow'][$fieldWithUidOfDefaultRecord]
62 .
' not found in table ' . $result[
'tableName'] .
' while editing record ' . $result[
'databaseRow'][
'uid'],
66 $result[
'defaultLanguageRow'] = $defaultLanguageRow;
69 if (!empty($result[
'processedTca'][
'ctrl'][
'transOrigDiffSourceField'])
70 && !empty($result[
'databaseRow'][$result[
'processedTca'][
'ctrl'][
'transOrigDiffSourceField']])
72 $result[
'defaultLanguageDiffRow'] = unserialize($result[
'databaseRow'][$result[
'processedTca'][
'ctrl'][
'transOrigDiffSourceField']]);
78 if (!empty($result[
'userTsConfig'][
'options.'][
'additionalPreviewLanguages'])) {
79 $additionalLanguageUids =
GeneralUtility::intExplode(
',', $result[
'userTsConfig'][
'options.'][
'additionalPreviewLanguages'],
true);
82 foreach ($additionalLanguageUids as $additionalLanguageUid) {
85 if ($additionalLanguageUid <= 0
86 || !isset($result[
'systemLanguageRows'][$additionalLanguageUid])
87 || $additionalLanguageUid === (
int)$result[
'databaseRow'][$languageField]
91 $translationInfo = $translationProvider->translationInfo(
92 $tableNameWithDefaultRecords,
93 (
int)$result[
'databaseRow'][$fieldWithUidOfDefaultRecord],
94 $additionalLanguageUid
96 if (!empty($translationInfo[
'translations'][$additionalLanguageUid][
'uid'])) {
98 $result[
'additionalLanguageRows'][$additionalLanguageUid] = $record;