_menu_link_sync_get_link_for_target_language function do not check if the node have the translation before getting it.
This is a problem during the execution of โ_menu_link_sync_get_most_popular_menu_among_siblingsโ where this function is used to find the most popular menu for the current language based on the source translation. The result is that the destination language is loaded even if it doesn't exist.
- Create a node in one language, place it at the root of a menu.
- Create a other node in the same language, place it at the root of a menu.
- For the second node, create a translation in another language and sync the menu item.
The following error is displayed:
InvalidArgumentException: Invalid translation language (__TRANSLATION_LANGCODE_) specified. in Drupal\Core\Entity\ContentEntityBase->getTranslation() (line 903 of docroot/core/lib/Drupal/Core/Entity/ContentEntityBase.php).
Check if translation exists before loading it.
Active
Code