Project

General

Profile

Actions

Bug #76174

closed

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

Added by Michael Nußbaumer almost 8 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
File Abstraction Layer (FAL)
Target version:
-
Start date:
2016-05-13
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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.

Actions #1

Updated by Andreas Allacher almost 8 years ago

The issue is regarding transOrigPointerTable TCA parameter being ignored when retrieving possible records in:
\TYPO3\CMS\Backend\Form\FormDataProvider\TcaInline

$connectedUidsOfDefaultLanguageRecord = $this->resolveConnectedRecordUids(
                    $result['processedTca']['columns'][$fieldName]['config'],
                    $result['tableName'],
                    $result['defaultLanguageRow']['uid'],
                    $result['defaultLanguageRow'][$fieldName]
                );

the tableName parameter here has to be the value from transOrigPointerTable if it is set, instead of $result['tableName']

Actions #2

Updated by Gerrit Code Review almost 8 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48495

Actions #3

Updated by Michael Nußbaumer almost 8 years ago

Gerrit Code Review wrote:

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48495

I am a little bit confused, your answers fixed a other bug i reported recently: https://forge.typo3.org/issues/76440

But not this one. Maybe posted to the wrong Bug?

Actions #4

Updated by Jonathan Heilmann over 7 years ago

This is still an issue in TYPO3 CMS 7.6.9 and 7.6.10.

The patch above did not resolve the bug.

Actions #5

Updated by Jonathan Heilmann over 7 years ago

After some more testings I've to correct myself. The patch resolves the bug, but the behavior is not the same as in TYPO3 CMS 6.2.x.

If there are no records in default language, the links are not shown.
But if you add a new record in default language, the links are shown in alternative page language.
When you localize the record from default language and there is no more record to localize, the links will disappear.

So, related to TYPO3 CMS 6.2.x the patch looks like it didn't fix the bug, but if you dig deeper, this is a nice behavior.

Also this patch fixes another issue:
If you localized a field in pages database table, the uid_foreign field has been set to the pages' uid instead of the pages_language_overlay's uid. This prevented from handling multiple translations, but is fixed with this patch.

In conclusion, I would appreciate, if this patch will be merged to next TYPO3 CMS 7.6 version.

Actions #6

Updated by Gerrit Code Review over 7 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48495

Actions #7

Updated by Gerrit Code Review over 7 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48495

Actions #8

Updated by Gerrit Code Review over 7 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48495

Actions #9

Updated by Gerrit Code Review over 7 years ago

Patch set 1 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/50859

Actions #10

Updated by Anonymous over 7 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #11

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF