• ohader's avatar
    [FEATURE] Introduce allowLanguageSynchronization · 2fd70c83
    ohader authored and Christian Kuhn's avatar Christian Kuhn committed
    This feature introduces a new functionality called
    "allowLanguageSynchronization" which can be set on a field
    configuration of a TCA column. This is the successor of
    "l10n_mode=mergeIfNotBlank" as the old option had several
    conceptual downsides:
    1) "mergeIfNotBlank" took the value of the default record
       during runtime, but only if the translation field was empty.
       This means it was not possible to see what the record
       actually contained without having all fields of the parent
       at hand.
    2) It was not possible to have a value "santa" in the original
       record but remove the option in a translation (because an
       empty string "" implicitly triggered the runtime call in the
    3) "mergeIfNotBlank" did not work on relations except for files
       fetched via the FileRepository API calls, but for no other
       inline elements.
    4) "mergeIfNotBlank" did the overlay functionality in the frontend,
       but only FormEngine and DataHandler took care of the option.
       Custom backend modules had to implement the same functionality.
    5) In FormEngine, there was an icon in the translation record that
       if the record kept empty the value of the original language was
       taken, but this is not optimal in terms of usability.
    6) "mergeIfNotBlank" did not take the new l10n_source option into
       account, where localizations could be made from other records
       than the default language "0".
    The new feature can be set on any TCA column setting:
    		['allowLanguageSynchronization'] = true;
    This brings an option to records with translations (both from
    l10n_parent and l10n_source) to have the value for all translations
    synchronized or explictly have a checkbox to use a custom value.
    The information whether a field is custom filled, or kept in sync
    from l10n_parent/l10n_source is stored in a separate field called
    "l10n_state" inside the database.
    The introduced upgrade wizard and TCA migration to remove
    "l10n_mode=mergeIfNotBlank" has been modified to migrate to this
    option and add a l10n_state database field if a TCA table used
    "mergeIfNotBlank" but did not add the l10n_state field manually
    via ext_tables.sql yet.
    New extensions can easily use the new option right away,
    extensions that need to stay compatible with v7 and v8 can add
    both options right away to have the same output.
    The main goals to achieve with this change is now:
    * Have consistent database values for all records regardless
      of l10n_mode=mergeIfNotBlank paving the way to fetch translated
      records without having to overlay (once l10n_mode=exclude is
      also copying values and relations)
    * Be more explicit for editors about records that have a different
      or the same state as their l10n_parent/l10n_source as a benefit
      for bigger instances with a lot of languages
    * Avoid hidden magic when retrieving localized records in the
      TYPO3 Frontend.
    Resolves: #79658
    Related: #79243
    Releases: master
    Change-Id: I6c2dbfeb09b47f958a536c9ab050c24ba4bbcbbd
    Reviewed-on: https://review.typo3.org/51291
    Tested-by: default avatarTYPO3com <no-reply@typo3.com>
    Reviewed-by: default avatarFrans Saris <franssaris@gmail.com>
    Tested-by: default avatarFrans Saris <franssaris@gmail.com>
    Reviewed-by: default avatarGeorg Ringer <georg.ringer@gmail.com>
    Tested-by: default avatarGeorg Ringer <georg.ringer@gmail.com>
    Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
    Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>