transOrigDiffSourceField

transOrigDiffSourceField
Path

$GLOBALS['TCA'][$table]['ctrl']

type

string (field name)

Scope

Proc. / Display

Field name, by convention by convention l10n_diffsource, which will be updated with the value of the original language record whenever the translation record is updated. This information is later used to compare the current values of the default record with those stored in this field. If they differ, there will be a display in the form of the difference visually. This is a big help for translators so they can quickly grasp the changes that happened to the default language text.

The field type in the database should be a large text field (clob/blob). If you do not define the field in the file ext_tables.sql it is automatically created with the correct type.

This field needs no configuration in $GLOBALS['TCA'][<table>]['columns'], but if you do, select the passthrough type. That will enable the undo function to also work on this field.

Example

Header field showing values from two other languages

Header field showing values from two other languages

EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php
<?php

return [
    'ctrl' => [
        'transOrigPointerField' => 'l18n_parent',
        'transOrigDiffSourceField' => 'l18n_diffsource',
        'languageField' => 'sys_language_uid',
        'translationSource' => 'l10n_source',
        // ...
    ],
    'columns' => [
        'sys_language_uid' => [
            'exclude' => true,
            'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language',
            'config' => [
                'type' => 'language',
            ],
        ],
        'l18n_parent' => [
            'displayCond' => 'FIELD:sys_language_uid:>:0',
            'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'items' => [
                    [
                        '',
                        0,
                    ],
                ],
                'foreign_table' => 'tx_myextension_domain_model_something',
                'foreign_table_where' =>
                    'AND {#tx_myextension_domain_model_something}.{#pid}=###CURRENT_PID###'
                    . ' AND {#tx_myextension_domain_model_something}.{#sys_language_uid} IN (-1,0)',
                'default' => 0,
            ],
        ],
        'l10n_source' => [
            'config' => [
                'type' => 'passthrough',
            ],
        ],
        'l18n_diffsource' => [
            'config' => [
                'type' => 'passthrough',
                'default' => '',
            ],
        ],
        // ...
    ],
];
Copied!