Skip to content

Conversation

@Jaykju
Copy link

@Jaykju Jaykju commented Oct 20, 2023

Typo3-Version: 11.5.30
Gridelements-Version: 11.1.0

I have encountered an interesting problem when copying records between grid-elements on different sites.

In this case there is a site that supports German and French (language_ids 0 and 2 respectively) and another site that supports German and English (language_ids 0 and 1 respectively). A translated record was copied from the German-French site to the German-English site which results in the "web"-Module crashing in the backend.

The reason for the crash is that the GridelementsPreviewRenderer.php::renderGridContainer() function uses Helper::getChildren() to fetch all children of a Gridelement regardless of their language. Because the French version was copied as well there is now a Record in this children array that has a sys_language_uid field that should not exist on this page. When not in a Gridelement Context typo3 just ignores these records.

The partial Resources/Private/Backend/Gridelements/Partials/PageLayout/Record/Header.html later tries to resolve {item.siteLanguage.flagIdentifier} which results in a LogicException being thrown because the current page does not support the language with, in this case, 2.

I don't know if the Helper Class should just respect the current language. This fix instead just filters any record that does not match the currently selected language from the childRecord array, so it is ignored in the preview.

@Jaykju Jaykju changed the title [BUGFIX] only include records with the correct language in backend preview [BUGFIX] Only include records with the correct language in backend preview Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant