diff --git a/core/modules/config_translation/config_translation.module b/core/modules/config_translation/config_translation.module index cf17244..f57d61a 100644 --- a/core/modules/config_translation/config_translation.module +++ b/core/modules/config_translation/config_translation.module @@ -215,12 +215,7 @@ function config_translation_config_translation_group_info() { foreach ($entity_manager->getDefinitions() as $entity_type => $entity_info) { // Make sure entity type is fieldable and has base path. if ($entity_info['fieldable'] && isset($entity_info['route_base_path'])) { - // Get all available bundles available for this entity type. - foreach (entity_get_bundles($entity_type) as $bundle => $bundle_info) { - if ($path = $entity_manager->getAdminPath($entity_type, $bundle)) { - $items[] = new ConfigEntityMapper($path . '/fields/{field_instance}' , 'field_instance', t('@label field'), MENU_CALLBACK); - } - } + $items[] = new ConfigEntityMapper($entity_info['route_base_path'] . '/fields/{field_instance}' , 'field_instance', t('@label field'), MENU_CALLBACK); } } diff --git a/core/modules/config_translation/lib/Drupal/config_translation/Tests/ConfigTranslationListUITest.php b/core/modules/config_translation/lib/Drupal/config_translation/Tests/ConfigTranslationListUITest.php index 659ff39..4f17dd7 100644 --- a/core/modules/config_translation/lib/Drupal/config_translation/Tests/ConfigTranslationListUITest.php +++ b/core/modules/config_translation/lib/Drupal/config_translation/Tests/ConfigTranslationListUITest.php @@ -28,7 +28,10 @@ class ConfigTranslationListUITest extends WebTestBase { 'config_translation', 'contact', 'custom_block', + 'field', + 'field_ui', 'menu', + 'node', 'shortcut', 'taxonomy', 'image', @@ -58,8 +61,10 @@ public function setUp() { 'administer blocks', 'administer contact forms', 'administer content types', + 'administer custom_block fields', 'administer filters', 'administer menu', + 'administer node fields', 'administer permissions', 'administer shortcuts', 'administer site configuration', @@ -379,6 +384,43 @@ function doPictureListTest() { } /** + * Tests the field listing for the translate operation. + */ + function doFieldListTest() { + // Create a base content type. + $content_type = entity_create('node_type', array( + 'type' => Unicode::strtolower($this->randomName(16)), + 'name' => $this->randomName(), + )); + $content_type->save(); + + // Look at a few fields on a few entity types. + $pages = array( + array( + 'list' => 'admin/structure/types/manage/' . $content_type->id() . '/fields', + 'field' => 'node.' . $content_type->id() . '.body', + ), + array( + 'list' => 'admin/structure/custom-blocks/manage/basic/fields', + 'field' => 'custom_block.basic.block_body', + ), + ); + + foreach ($pages as $values) { + // Get fields listing. + $this->drupalGet($values['list']); + + $translate_link = $values['list'] . '/' . $values['field'] . '/translate'; + // Test if the link to translate the field is on the page. + $this->assertLinkByHref($translate_link); + + // Test if the link to translate actually goes to the translate page. + $this->drupalGet($translate_link); + $this->assertRaw('' . t('Language') . ''); + } + } + + /** * Tests the date format listing for the translate operation. */ function doDateFormatListTest() { @@ -433,6 +475,7 @@ public function testTranslateOperationInListUI() { $this->doImageStyleListTest(); $this->doPictureListTest(); $this->doDateFormatListTest(); + $this->doFieldListTest(); // Views is tested in Drupal\config_translation\Tests\ConfigTranslationViewListUITest