Chris@0: moduleExists('field_ui')) { Chris@0: // Add fields entity mappers to all fieldable entity types defined. Chris@0: foreach ($entity_manager->getDefinitions() as $entity_type_id => $entity_type) { Chris@0: $base_route = NULL; Chris@0: try { Chris@0: $base_route = $route_provider->getRouteByName('entity.field_config.' . $entity_type_id . '_field_edit_form'); Chris@0: } Chris@0: catch (RouteNotFoundException $e) { Chris@0: // Ignore non-existent routes. Chris@0: } Chris@0: Chris@0: // Make sure entity type has field UI enabled and has a base route. Chris@0: if ($entity_type->get('field_ui_base_route') && !empty($base_route)) { Chris@0: $info[$entity_type_id . '_fields'] = [ Chris@0: 'base_route_name' => 'entity.field_config.' . $entity_type_id . '_field_edit_form', Chris@0: 'entity_type' => 'field_config', Chris@0: 'title' => t('Title'), Chris@0: 'class' => '\Drupal\config_translation\ConfigFieldMapper', Chris@0: 'base_entity_type' => $entity_type_id, Chris@0: 'weight' => 10, Chris@0: ]; Chris@0: } Chris@0: } Chris@0: } Chris@0: } Chris@0: Chris@0: /** Chris@0: * Alter existing translation tabs for translation of configuration. Chris@0: * Chris@0: * This hook is useful to extend existing configuration mappers with new Chris@0: * configuration names, for example when altering existing forms with new Chris@0: * settings stored elsewhere. This allows the translation experience to also Chris@0: * reflect the compound form element in one screen. Chris@0: * Chris@0: * @param array $info Chris@0: * An associative array of discovered configuration mappers. Use an entity Chris@0: * name for the key (for entity mapping) or a unique string for configuration Chris@0: * name list mapping. The values of the associative array are arrays Chris@0: * themselves in the same structure as the *.config_translation.yml files. Chris@0: * Chris@0: * @see hook_translation_info() Chris@0: * @see \Drupal\config_translation\ConfigMapperManagerInterface Chris@0: */ Chris@0: function hook_config_translation_info_alter(&$info) { Chris@0: // Add additional site settings to the site information screen, so it shows Chris@0: // up on the translation screen. (Form alter in the elements whose values are Chris@0: // stored in this config file using regular form altering on the original Chris@0: // configuration form.) Chris@0: $info['system.site_information_settings']['names'][] = 'example.site.setting'; Chris@0: } Chris@0: Chris@0: /** Chris@0: * @} End of "addtogroup hooks". Chris@0: */