Project

General

Profile

Actions

Bug #88024

open

allowLanguageSynchronization doesn't synchronise cropping from images

Added by Chris Müller over 5 years ago. Updated about 2 years ago.

Status:
New
Priority:
Must have
Assignee:
-
Category:
Localization
Target version:
-
Start date:
2019-03-27
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I have an image in a TCA and want to reuse this image (and the cropping) in localised records. I configured the field (relevant snippet):

'image' => [
    'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
        'image',
        [
            ...
            'behaviour' => [
                'allowLanguageSynchronization' => true,
            ],
        ]
    ),
]

In backend now I have the possibility to switch between "Custom value"/"Value of default language" in the image field. I created a new record, added an image, cropped it. Now I localised the record, the image with cropping is copied over from the default language.

When I change the cropping of the default language record, the new cropping is not used for the localised record ("Value of default language" is set) in backend preview and frontend output.

When I now change the image in the default language record and apply a cropping, both are set in the localised record.

I encountered the same problem with l10n_mode=exclude: If the cropping is changed later it is not reflected in the localised record.

TYPO3 version 9.5.5


Related issues 3 (2 open1 closed)

Related to TYPO3 Core - Feature #88766: Unpredictable allowLanguageSynchronization behaviour with file referencesNew2019-07-15

Actions
Related to TYPO3 Core - Bug #83064: Media cropping data should not be localizableClosed2017-11-22

Actions
Related to TYPO3 Core - Story #101561: DataHandler related translation issuesNew2023-08-03

Actions
Actions #1

Updated by Benni Mack over 5 years ago

Hi Chris,

I guess it's not "bubbling down" to all values of the translated record. So you'd need to set this for the fields within sys_file_reference themselves as well. I can't even definitively say that `allowLanguageSynchronization` works with TCA type "imagemanipulation", so this could be an issue as well.

Actions #2

Updated by Chris Müller over 5 years ago

First try: I added allowLanguageSynchronization to the crop column in overrideChildTca:

'image' => [
    'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
        'image',
        [
            'overrideChildTca' => [
                'columns' => [
                    'crop' => [
                        'config' => [
                            'behaviour' => [
                                'allowLanguageSynchronization' => true,
                            ],
                        ],
                    ],
                ],
            ],
            'behaviour' => [
                'allowLanguageSynchronization' => true,
            ],
        ],
        $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
    ),
],

When I now open the image tab to see the cropped images I got the exception from the AJAX call:

Call to a member function isCustomState() on null
in /var/www/html/public/typo3/sysext/backend/Classes/Form/FieldWizard/LocalizationStateSelector.php line 96

The problem here is, that

$localizationState = State::fromJSON(
    $this->data['tableName'],
    $this->data['databaseRow'][$l10nStateFieldName] ?? null
);

returns null, because $this->data['databaseRow'][$l10nStateFieldName] is null

So, second try: Add allowLanguageSynchronization directly to sys_file_reference:

'crop' => [
    'exclude' => true,
    'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.crop',
    'config' => [
        'type' => 'imageManipulation',
        'behaviour' => [
            'allowLanguageSynchronization' => true,
        ],
    ]
],

That works, if the cropping is changed in the default language record, the translated record shows also the new cropping.

Are there drawbacks if allowLanguageSynchronization is allowed for all sys_file_reference records? But nevertheless I think, allowLanguageSynchronization should be possible also in overrideChildTca config.

Actions #3

Updated by André Buchmann over 5 years ago

Thx Chris for your research.

Following your second try by overriding the sys_file_reference TCA with

$GLOBALS['TCA']['sys_file_reference']['columns']['crop']['config']['behaviour']['allowLanguageSynchronization'] = true;

the crop is updated on every change in default lang in those cases:

1. Crop values on images with 'l10n_mode' => 'exclude' are correctly updated
2. Translate able images if "Value of default language"

'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
                'image',
                [
                    'behaviour' => [
                        'allowLanguageSynchronization' => true,
                    ],

If the image is set to "Custom value" the crop is not updated. So it's working fine for me!

Actions #4

Updated by Susanne Moog almost 5 years ago

  • Sprint Focus set to On Location Sprint
Actions #5

Updated by Henrik Ziegenhain almost 4 years ago

Thanks for your research, Chris and André.

Are there any news on this issue? Would be a great enhancement to "allowLanguageSynchronization".

Actions #6

Updated by André Buchmann almost 4 years ago

  • Related to Feature #88766: Unpredictable allowLanguageSynchronization behaviour with file references added
Actions #7

Updated by André Buchmann almost 4 years ago

Hey Hendrik,

in one multilingual project I have it setup like this and it's working for the clients needs. But in the latests project I also use the l10nmgr and localizer. And in this case, I needed to remove all of this again. Please see Jo's comment here: #88024-5

I added the mentioned ticket as related here. I'm aware, that it's only some parts related.

Actions #8

Updated by Henrik Ziegenhain almost 4 years ago

Thanks André,

quickly tested it and it works like expected for my need.

Any chance to push this forward and maybe see it in Core?!
Fully agree to your findings and Jo's comments on #88766 - respecting all aspects, this is quickly getting some numbers bigger.

Maybe our client is willing to sponsor this bugfix.

Actions #9

Updated by Ephraim Härer over 3 years ago

Are there any updates or workaround for this problem? We have the same problem on a website with 10 languages.

Actions #10

Updated by Mathias Bolt Lesniak over 3 years ago

  • Related to Bug #83064: Media cropping data should not be localizable added
Actions #11

Updated by Mathias Bolt Lesniak over 3 years ago

Ephraim Härer wrote in #note-9:

Are there any updates or workaround for this problem? We have the same problem on a website with 10 languages.

This extension should fix the issue:
https://extensions.typo3.org/extension/unlocalizedcrop
(https://github.com/b13/unlocalizedcrop)

Actions #12

Updated by Oliver Hader about 2 years ago

  • Sprint Focus deleted (On Location Sprint)
Actions #13

Updated by Jo Hasenau over 1 year ago

  • Related to Story #101561: DataHandler related translation issues added
Actions

Also available in: Atom PDF