Invalid argument exception when changing language of node with menu link to und or zxx

Created on 18 July 2018, almost 7 years ago
Updated 22 July 2024, 9 months ago

@FeyP reported the original (related) issue which happens in core but the problematic portion of the code is identical in token and the issue also happen here. I've ported the patch here based on his work in the related issue.

When changing the language of an existing node to a pseudo language I get the following error:

InvalidArgumentException</em>: Invalid translation language (und) specified. in <em class="placeholder">Drupal\Core\Entity\ContentEntityBase-&gt;addTranslation()</em> (line <em class="placeholder">947</em> of <em class="placeholder">core/lib/Drupal/Core/Entity/ContentEntityBase.php</em>). <pre class="backtrace">token_node_menu_link_submit(&#039;node&#039;, Object, Array, Object)
call_user_func_array(&#039;token_node_menu_link_submit&#039;, Array) (Line: 299)
...

Here is the introduction of the original report:

Changing the language of a translatable node with a translatable menu link from a "real" language (e.g. en) to a "pseudo" language (und or zxx) will result in an invalid argument exception: Invalid translation language (und) specified. or Invalid translation language (zxx) specified. respectively.

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡¨πŸ‡­Switzerland idflood

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024