I created different menus and need them to be displayed in a node based on the language currently visited for a specific node type.
Via my theme.theme, I added the following code to retrieve the menus:
if($lang == 'pt') {
$recipe_block = \Drupal\block\Entity\Block::load('recipespt');
$variables['recipe_menu_block_view'] = \Drupal::entityTypeManager()->getViewBuilder('block')->view($recipe_block);
} elseif($lang == 'es') {
$recipe_block = \Drupal\block\Entity\Block::load('recipeses');
$variables['recipe_menu_block_view'] = \Drupal::entityTypeManager()->getViewBuilder('block')->view($recipe_block);
}
Then I went into the node template and pulled the menus:
{% if content.field_product_type['0']['#context']['value'] == 'Recipe' %}
{{recipe_menu_block_view}}
{% else %}
{{cocktail_menu_block_view}}
{% endif %}
When I visit the main site(English) the menu links look ok.
But when I switch language and hover over the menu, instead of seeing the URL alias I am seeing the node id.
How can I pull the menu through the .theme and see the node alias instead of the node alias?