Issue Bug Closed

#76174FAL: The TCA options 'showSynchronizationLink' and 'showAllLocalizationLink' doesn't work

Michael Nußbaumer 05/13/16, 09:00 updated 10/02/18, 11:13

Description

Hello,

i found a problem with the two tca options named in the Subject. I used them till there is a Bug with content fallback of FAL fields.

Test case:
– Set up the TCA for ‘pages_language_overlay’:

   $GLOBALS['TCA']['pages_language_overlay']['columns']['media']['config']['appearance']['showPossibleLocalizationRecords'] = true;
   $GLOBALS['TCA']['pages_language_overlay']['columns']['media']['config']['appearance']['showRemovedLocalizationRecords']  = true;
   $GLOBALS['TCA']['pages_language_overlay']['columns']['media']['config']['appearance']['showSynchronizationLink']         = true;
   $GLOBALS['TCA']['pages_language_overlay']['columns']['media']['config']['appearance']['showAllLocalizationLink']         = false;
- Select a Media for a page in the default translation
– Create a translation of the page
– Go to the ressources tab

Now you see that the option to synchronize is missing

Now i was searching of an missconfiguration of myself, and the position where the tca option is checked and the button should be generated.

I found what causes the problem, it is following file and code:
_typo3_src-7.6.4/typo3/sysext/backend/Classes/Form/Container/InlineControlContainer.php_

        // Render the localization links if needed
        $localizationLinks = '';
        if ($numberOfNotYetLocalizedChildren) {
            // Add the "Localize all records" link before all child records:
            if (isset($config['appearance']['showAllLocalizationLink']) && $config['appearance']['showAllLocalizationLink']) {
                $localizationLinks = ' ' . $this->getLevelInteractionLink('localize', $nameObject . '-' . $foreign_table, $config);
            }
            // Add the "Synchronize with default language" link before all child records:
            if (isset($config['appearance']['showSynchronizationLink']) && $config['appearance']['showSynchronizationLink']) {
                $localizationLinks .= ' ' . $this->getLevelInteractionLink('synchronize', $nameObject . '-' . $foreign_table, $config);
            }
        }

I found out that the value of $numberOfNotYetLocalizedChildren isn’t correct.

So i took a look at where this value is set:

        // @todo: It might be a good idea to have something like "isLocalizedRecord" or similar set by a data provider
        $isLocalizedParent = $language > 0
            && $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']][0] > 0
            && MathUtility::canBeInterpretedAsInteger($row['uid']);
        $numberOfFullLocalizedChildren = 0;
        $numberOfNotYetLocalizedChildren = 0;
        foreach ($this->data['parameterArray']['fieldConf']['children'] as $child) {
            if (!$child['isInlineDefaultLanguageRecordInLocalizedParentContext']) {
                $numberOfFullLocalizedChildren ++;
            }
            if ($isLocalizedParent && $child['isInlineDefaultLanguageRecordInLocalizedParentContext']) {
                $numberOfNotYetLocalizedChildren ++;
            }
        }

Now i could localize the problem, the $this->data[‘parameterArray’][‘fieldConf’][‘children’] is empty. I couldn’t work out what exactly the problem is and why it is empty at that point.

The problem should maybe be in one of this files:
– typo3_src-7.6.4/typo3/sysext/backend/Classes/Form/Container/InlineControlContainer.php
– typo3_src-7.6.4/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaInlineConfiguration.php
– typo3_src-7.6.4/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaInline.php
– typo3_src-7.6.4/typo3/sysext/core/Classes/Database/RelationHandler.php

The Problem also exists in 7.6.5.

Reviews 2