Problem/Motivation
On a multilingual site, a menu link created by the Menu link content module (MenuLinkContent plugin) can have its "link" field translated per language, so the target URL/path may differ between translations of the same menu link entity.
MenuLinkContent::getUrlObject() currently falls through to the parent implementation, which does not take the current language context into account when resolving the URL. As a result, the menu link renders with the URL from the entity's default/original translation instead of the URL stored in the active language's translation of the "link" field.
Proposed resolution
Override getUrlObject() in MenuLinkContent so that, when the site is multilingual, the URL is resolved from the current translation of the entity's "link" field (via getEntity()->get('link')->first()->getUrl()) instead of relying on the parent's non-translation-aware logic. On a non-multilingual site, behavior is unchanged (falls back to parent::getUrlObject()).
Remaining tasks
Review, add test coverage for the multilingual case.
| Comment | File | Size | Author |
|---|---|---|---|
| core-menu-link-translatable-d11.patch | 933 bytes | burcu.sogut@drupart.com.tr |
Comments
Comment #2
larowlanNice find - any chance you could make an MR for this?