- Merge request !14Issue #3105028: node:source:menu-link returns translated menu, not source menu → (Open) created by pgrandeg
- 🇷🇴Romania bboty
Thank you, the patch has been working well on my client's website for 3 years now.
- Status changed to RTBC
over 1 year ago 2:18pm 11 May 2023 - Status changed to Needs work
over 1 year ago 9:14pm 12 May 2023 - 🇨🇭Switzerland berdir Switzerland
+++ b/token.tokens.inc @@ -680,12 +680,17 @@ function token_tokens($type, array $tokens, array $data = [], array $options = [ foreach ($tokens as $name => $original) { + if (preg_match('/\:source\:/', $original)) { + $langcode = $defaultLanguage->getId(); + }
this makes the assumption that the source is the same as the default translation, but that's necessarily the case.
What should be done instead I think is that the node:source token needs to update the langcode option to match its active language, that should be passed through both to [node:source:menu-link] (which this patch doesn't yet handle) and nested tokens.
Also, tests would be great, but source tests are quite lacking as we don't actually add translations, so it can't really be verified that this works.
- First commit to issue fork.
- last update
9 months ago 78 pass