b13 / link2language

Allows to set links to a specific language of a page in FormEngine and the RTE link selector
GNU General Public License v2.0
17 stars 10 forks source link

Content Elements in "Connected Mode" only in default language #11

Closed fjaeker closed 3 weeks ago

fjaeker commented 2 years ago

Hi,

we have a TYPO3 (10.4.26) with 11 languages. The default language is "English (US)". Now we want to set an anchor link to a german content element ("Connected mode") on a german page. When I open the link browser, only the content elements of the default language are displayed for selection and can be linked, which is not usefull here. There are also pages with content elements that are created in "Free Mode", which are then displayed for selection (this is what I also expected in "Connected Mode"). Is this a bug or have I overlooked something else? Thank you.

bmack commented 2 years ago

@fjaeker I think the Frontend templates need to fetch the original UID (Fluid Styled Content does it like this:

            <div id="c{data.uid}" ...>
                <f:if condition="{data._LOCALIZED_UID}">
                    <a id="c{data._LOCALIZED_UID}"></a>
                </f:if>

This way, both IDs are available for deeplinking, which is then correct and link2language allows to choose the default ID then.

t3touch commented 2 years ago

I had the same problem in TYPO3 11. After changing line 122 in PageLinkHandler.php from $queryBuilder->createNamedParameter([0, -1], Connection::PARAM_INT_ARRAY) to $queryBuilder->createNamedParameter([0, ...$languageIdsToFindFreeModeItems, -1], Connection::PARAM_INT_ARRAY) the content elements from the other languages are available in the LinkBrowser

t3touch commented 2 years ago

@bmack The _LOCALIZED_UID is still the uid from the default language tt_content record if the freeMode is used.

t3touch commented 2 years ago

This could also be a simple solution/workaround if the freeMode is used.

<f:if condition="{data.l18n_parent} > 0">
    <a id="c{data.l18n_parent}"></a>
</f:if>
runepiper commented 5 months ago

I think we have the same problem. We wan't to link from a translated page to a translated content element. Die page browser shows content elements in the default language. This results in a problem, because the link set will contain &L=0 and not &L=2. If we click on „Link to English“ (in our case, because german is the default language), the link contains &L=2 but removes the fragment pointing to the content element. If you manually edit the link &L=2&#1234 it works perfectly.

darthnorman commented 5 months ago

This might be a result of #10

You can't link to a translated content element anymore, since L=0 is always set in this case.

hannesbochmann commented 5 months ago

Just my 2 cents. I think the linking of content elements isn't done the right way. First of all there needs to be some option to link to a element in a specific language. Right now this is not possible. You can either link to a translated page or to a content element in the default language. The easiest solution would be to offer the content elements of all languages for selection even if no free mode is used.

Furthermore the links should always contain the uid of the original content element. So either l18n_parent for translations or just the uid for the original. Right now the uid is used no matter what. But I think that's not correct. TYPO3 usually expects the uid of the original element and loads an overlay for the given language. Following this logic a link should contain the page uid of the original page, a language parameter for the desired language and a section with the uid of the original content element. But this part is arguable as fluid_styled_content doesn't deliver it's templates as mentioned in https://github.com/b13/link2language/issues/11#issuecomment-1113418844 for no reason. So they seem to expect an uid of a translation as well and not just the original.

I can provide a PR with all necessary changes.