diff --git a/core/modules/config_translation/config_translation.api.php b/core/modules/config_translation/config_translation.api.php index e8151b3..b75024b 100644 --- a/core/modules/config_translation/config_translation.api.php +++ b/core/modules/config_translation/config_translation.api.php @@ -33,36 +33,15 @@ * @see \Drupal\config_translation\Routing\RouteSubscriber::routes() */ function hook_config_translation_info(&$info) { - $entity_manager = \Drupal::entityManager(); - $route_provider = \Drupal::service('router.route_provider'); - - // If field UI is not enabled, the base routes of the type - // "field_ui.instance_edit_$entity_type" are not defined. - if (\Drupal::moduleHandler()->moduleExists('field_ui')) { - // Add fields entity mappers to all fieldable entity types defined. - foreach ($entity_manager->getDefinitions() as $entity_type => $entity_info) { - $base_route = NULL; - try { - $base_route = $route_provider->getRouteByName('field_ui.instance_edit_' . $entity_type); - } - catch (RouteNotFoundException $e) { - // Ignore non-existent routes. - } - - // Make sure entity type is fieldable and has a base route. - if ($entity_info['fieldable'] && !empty($base_route)) { - $info[$entity_type . '_fields'] = array( - 'base_route_name' => 'field_ui.instance_edit_' . $entity_type, - 'entity_type' => 'field_instance', - 'title' => t('!label field'), - 'class' => '\Drupal\config_translation\ConfigFieldInstanceMapper', - 'base_entity_type' => $entity_type, - 'list_controller' => '\Drupal\config_translation\Controller\ConfigTranslationFieldInstanceListController', - 'weight' => 10, - ); - } - } - } + // This module has configuration whose configuration names can change. + // Do not forgot to call ConfigMapperManager::clearCachedDefinitions() when + // the names change. + $config_names = mymodule_get_config_names(); + $info['mymodule.settings'] = array( + 'title' => 'Mymodule settings', + 'base_route_name' => 'mymodule.settings', + 'config_names' => $config_names, + ); } /**