Skip to content

includeFloating elements missing in alternate languages #618

@Narfsn

Description

@Narfsn

Using container with tt_content CType shortcut elements in an alternate language allows the selection of translated containers in the alternate language. The shortcut itself handles those cases by falling back to the default language and applying the overlay. Thus the container element itself is rendered, but it fails to find the child elements.

Container versions: ^3.1.2
TYPO3: ^12.4 & ^13.4

Language Configuration:

languages:
  -
    title: Deutsch
    enabled: true
    base: /de/
    typo3Language: de
    locale: de_DE.UTF-8
    iso-639-1: de
    navigationTitle: Deutsch
    hreflang: de
    direction: ltr
    flag: de
    languageId: 0
  -
    title: Englisch
    enabled: true
    base: /en/
    typo3Language: default
    locale: en_US.UTF-8
    iso-639-1: en
    navigationTitle: ''
    hreflang: en-US
    direction: ''
    fallbackType: strict
    fallbacks: ''
    flag: us
    languageId: 2

This used to work until 3.1.2 and the removal of B13\Container\Domain\Factory\PageView\Frontend\ContainerFactory::doOverlay() due to #575.

Content childs of the container are using the default language container uid as tx_container_parent if the parent container is a translation.
The new B13\Container\Domain\Factory\FrontendContainerFactory only applies the l18n parent on LanguageAspect::OVERLAYS_OFF (Which would be fallbackType: free).

See:

$conf = ['where' => 'tx_container_parent=' . $record['uid'], 'orderBy' => 'sorting', 'pidInList' => $record['pid']];

public function buildContainer(ContentObjectRenderer $cObj, Context $context, ?int $uid = null): Container
{
    [...]
    if ($languageAspect->getOverlayType() === LanguageAspect::OVERLAYS_OFF && $record['l18n_parent'] > 0) {
        $conf['where'] .= ' OR tx_container_parent=' . $record['l18n_parent'];
    }
    [...]
}

The above configuration results in something like LanguageAspect::OVERLAYS_ON_WITH_FLOATING which is afaik the default behavior.
I'm not entirely sure if the support was intentionally droped, but the change below would result in the content elements being displayed again:

public function buildContainer(ContentObjectRenderer $cObj, Context $context, ?int $uid = null): Container
{
    [...]
    if ($languageAspect->getOverlayType() === LanguageAspect::OVERLAYS_OFF || ($languageAspect->getOverlayType() === LanguageAspect::OVERLAYS_ON_WITH_FLOATING) && $record['l18n_parent'] > 0) {
        $conf['where'] .= ' OR tx_container_parent=' . $record['l18n_parent'];
    }
    [...]
}

Hope my description is somewhat understandable. I can provide a sample project if necessary.

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