Skip to content

FrontendContainerFactory does not correctly resolve children in connected mode with fallbackType: fallback #733

@prathers

Description

@prathers

Extension version: 3.2.2
TYPO3 version: 13.x
PHP version: 8.4

In a multilanguage setup using fallbackType: fallback in site config, content elements inside containers are not rendered in any non-default language on the frontend, even when the container and all its children are fully translated in connected mode.
Switching to fallbackType: free makes the content visible, but this is not an acceptable solution as it disables language fallback sitewide.

Root cause

FrontendContainerFactory::buildContainer() fetches children using:

$conf = ['where' => 'tx_container_parent=' . $record['uid'], ...];

Where $record['uid'] is the UID of the translated container record. This only works if translated child records have tx_container_parent pointing to the translated container UID.

However, TYPO3's connected mode translation workflow stores translated children with tx_container_parent pointing to the default language container UID — not the translated container UID. This is consistent with how l18n_parent works for standard content elements.

The backend ContainerFactory::buildContainer() handles this correctly by fetching children of the default language container and then resolving their translations via l18n_parent:

// connected mode
$defaultRecords = $this->children($defaultRecord, 0);
$childRecords = $this->localizedRecordsByDefaultRecords($defaultRecords, $language);

The frontend factory does not mirror this logic, causing it to find zero children for translated containers in connected mode.
The only partial workaround in FrontendContainerFactory is:

if ($languageAspect->getOverlayType() === LanguageAspect::OVERLAYS_OFF && $record['l18n_parent'] > 0) {
    $conf['where'] .= ' OR tx_container_parent=' . $record['l18n_parent'];
}

But this is gated on OVERLAYS_OFF which corresponds to fallbackType: free — it never runs with fallbackType: fallback.

Steps to reproduce

  1. Set up a multilanguage TYPO3 13 site with a default language and one or more additional languages using fallbackType: fallback in site config
  2. Create a container element in the default language with child content elements
  3. Translate the container and its children in connected mode
  4. View the page in a non-default language on the frontend — container children are not rendered
  5. Switch fallbackType to free — content becomes visible

Content inside translated containers should be visible on the frontend in connected mode with fallbackType: fallback, consistent with how the backend ContainerFactory resolves children.

Suggested fix

FrontendContainerFactory::buildContainer() should detect connected mode (i.e. $record['l18n_parent'] > 0) and mirror the backend logic: fetch children of the default language container, then resolve their translations via l18n_parent, rather than querying by the translated container UID directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions