In issue https://www.drupal.org/project/rest_menu_items/issues/3039979 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);
  }
CommentFileSizeAuthor
#2 rest_menu_items-3427798-2.patch689 bytesvistree

Comments

vistree created an issue. See original summary.

vistree’s picture

StatusFileSize
new689 bytes
batigolix’s picture

Issue tags: +finalist-sprint
batigolix’s picture

Status: Active » Needs review
batigolix’s picture

Status: Needs review » Fixed
batigolix’s picture

Many thanks!

  • a598d039 committed on 3.0.x
    Issue #3427798 by vistree, batigolix: Menu Items Extras fields should be...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.