georgringer / news

TYPO3 Extension news
GNU General Public License v2.0
264 stars 357 forks source link

Using EXT:redirects with a news article in a not default language as a target doesn't work #2501

Open createdwithlove opened 2 months ago

createdwithlove commented 2 months ago

After reading the documentation up and down and forwards and backwards, I've come to the conclusion that it must be a bug somehow and hope, someone can help.

I have already started a topic on stackoverflow, but unfortunately there is no solution there: https://stackoverflow.com/questions/78422845/how-to-setup-routeenhancer-for-extnews-which-works-in-redirct-module-for-linkin

Here is a brief summary of the problem: The links that are generated with EXT:redirect when you want to redirect to a news record in a foreign language are wrong. The generated path is the one from the default language (e.g. https://mysite.com/news/article/) while the last part is the translated news title (e.g. mein-deutscher-beitrag).

The configurations from the following parts of the documentation are in use: https://docs.typo3.org/p/georgringer/news/11.4/en-us/Tutorials/BestPractice/Routing/Index.html https://docs.typo3.org/p/georgringer/news/11.4/en-us/Tutorials/BestPractice/Linkhandler/Index.html https://docs.typo3.org/p/georgringer/news/11.4/en-us/Tutorials/BestPractice/PreviewOfRecord/Index.html https://docs.typo3.org/p/georgringer/news/11.4/en-us/Tutorials/ExtendNews/DataProcessing/LanguageMenuProcessor.html

Another additional information: Creating such a link in a rte field behaves like this: translated page -> link to: translated news article -> works fine ✅ translated page -> link to: default language news article -> (correct) link to translated news article ❌ default language page -> link to: translated news article -> mixed link (as described above) ❌

Setting an additional param like L=1doesn't seem to have any impact

createdwithlove commented 2 months ago

If you take the faulty parts apart, it seems that the additionalParams are overwritten and therefore the L=1 is never taken into account.

config.recordLinks.tx_news {
    typolink {
        …
        # overwrites all additionalParams ->
        additionalParams.data = field:uid
        …
    }
}

With following workaround this behaviour is omitted:

additionalParams {
  wrap = &tx_news_pi1[controller]=News&tx_news_pi1[action]=detail&tx_news_pi1[news]={field:uid}&L={field:sys_language_uid}
  insertData = 1
}

Could someone else test this? What side effects could this cause?