diff --git a/core/modules/language/language.module b/core/modules/language/language.module index 6bbb5a7..5b8cc1c 100644 --- a/core/modules/language/language.module +++ b/core/modules/language/language.module @@ -201,7 +201,7 @@ function language_theme() { function language_entity_supported() { $supported = array(); foreach (entity_get_info() as $entity_type => $info) { - if (!empty($info['fieldable']) && !empty($info['translatable'])) { + if ((!empty($info['fieldable']) || $entity_type == 'menu_link') && !empty($info['translatable'])) { $supported[$entity_type] = $entity_type; } } diff --git a/core/modules/menu/menu.module b/core/modules/menu/menu.module index ece3aac..5052b8e 100644 --- a/core/modules/menu/menu.module +++ b/core/modules/menu/menu.module @@ -151,6 +151,29 @@ function menu_entity_info_alter(&$entity_info) { $entity_info['menu']['controllers']['form'] = array( 'default' => 'Drupal\menu\MenuFormController', ); + if (isset($entity_info['menu_link'])) { + $entity_info['menu_link']['entity_keys']['bundle'] = 'menu_name'; + if (Drupal::moduleHandler()->moduleExists('language')) { + $entity_info['menu_link']['translatable'] = TRUE; + } + } +} + +/** + * Implements hook_entity_bundle_info(). + */ +function menu_entity_bundle_info() { + $bundles = array(); + $info = Drupal::service('plugin.manager.entity')->getDefinition('menu'); + $config_names = config_get_storage_names_with_prefix($info['config_prefix'] . '.'); + foreach ($config_names as $config_name) { + $config = config($config_name); + $bundles['menu_link'][$config->get('id')] = array( + 'label' => $config->get('label'), + ); + } + + return $bundles; } /**