- Issue created by @vistree
In issue
https://www.drupal.org/project/rest_menu_items/issues/3039979
β¨
Menu Items Extras fields also returned by the API
Fixed
menu item extra fields are added to "Rest menu items". The implementation has been merged to current dev version.
The problem is, that only the default language values are returned instead of the current language version.
I tried to implement a fix - please review patch attached.
Added to function checkContentFields() after:
$menu_link_content = $this->menuLinkContentStorage->load($id);
if ($menu_link_content) {
the new lines:
$lang_code = \Drupal::service('language_manager')->getCurrentLanguage()->getId();
if ($menu_link_content->hasTranslation($lang_code)) {
$menu_link_content = $menu_link_content->getTranslation($lang_code);
}
Active
3.0
Code