diff --git a/config_translation.module b/config_translation.module index c323770..ded2307 100644 --- a/config_translation.module +++ b/config_translation.module @@ -204,21 +204,45 @@ function config_translation_config_translation_group_info() { // Contact. $items[] = new ConfigEntityMapper('admin/structure/contact/manage/{contact_category}', 'contact_category', t('@label contact category')); + // Date format. + $items[] = new ConfigEntityMapper('admin/config/regional/date-time/formats/manage/{date_format}', 'date_format', t('@label date format')); + + // Fields. + $entity_manager = Drupal::entityManager(); + 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); + } + } + } + } + // Filter. $items[] = new ConfigEntityMapper('admin/config/content/formats/manage/{filter_format}', 'filter_format', t('@label text format'), MENU_LOCAL_TASK, TRUE); + // Images. + $items[] = new ConfigEntityMapper('admin/config/media/image-styles/manage/{image_style}', 'image_style', t('@label image style'), MENU_LOCAL_TASK); + // Language. $items[] = new ConfigEntityMapper('admin/config/regional/language/edit/{language_entity}', 'language_entity', t('@label language'), MENU_CALLBACK); - // Menu. + // Menu. $items[] = new ConfigEntityMapper('admin/structure/menu/manage/{menu}', 'menu', t('@label menu')); + // Picture. + $items[] = new ConfigEntityMapper('admin/config/media/picturemapping/{picture_mapping}', 'picture_mapping', t('@label picture mapping'), MENU_LOCAL_TASK); + // Shortcut. $items[] = new ConfigEntityMapper('admin/config/user-interface/shortcut/manage/{shortcut}', 'shortcut', t('@label shortcut set')); // System. $items[] = new ConfigGroupMapper('admin/config/development/maintenance', t('System maintenance'), array('system.maintenance'), MENU_LOCAL_TASK, TRUE); $items[] = new ConfigGroupMapper('admin/config/system/site-information', t('Site information'), array('system.site'), MENU_LOCAL_TASK, TRUE); + $items[] = new ConfigGroupMapper('admin/config/services/rss-publishing', t('RSS publishing'), array('system.rss'), MENU_LOCAL_TASK, TRUE); // Taxonomy. $items[] = new ConfigEntityMapper('admin/structure/taxonomy/manage/{taxonomy_vocabulary}', 'taxonomy_vocabulary', t('@label vocabulary')); @@ -230,21 +254,6 @@ function config_translation_config_translation_group_info() { // Views. $items[] = new ConfigEntityMapper('admin/structure/views/view/{view}', 'view', t('@label view'), MENU_CALLBACK); - - // Fields. - $entity_manager = Drupal::entityManager(); - 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); - } - } - } - } - return $items; } diff --git a/lib/Drupal/config_translation/Tests/ConfigTranslationListUITest.php b/lib/Drupal/config_translation/Tests/ConfigTranslationListUITest.php index 773c2b4..5d6c04f 100644 --- a/lib/Drupal/config_translation/Tests/ConfigTranslationListUITest.php +++ b/lib/Drupal/config_translation/Tests/ConfigTranslationListUITest.php @@ -31,6 +31,8 @@ class ConfigTranslationListUITest extends WebTestBase { 'menu', 'shortcut', 'taxonomy', + 'image', + 'picture', ); public static function getInfo() { @@ -63,6 +65,8 @@ class ConfigTranslationListUITest extends WebTestBase { 'administer taxonomy', 'administer users', 'administer languages', + 'administer image styles', + 'administer pictures', 'translate configuration', ); @@ -313,6 +317,64 @@ class ConfigTranslationListUITest extends WebTestBase { } /** + * Tests the image style listing for the translate operation. + */ + function doImageStyleListTest() { + // Get the image style listing. + $this->drupalGet('admin/config/media/image-styles'); + + $translate_link = 'admin/config/media/image-styles/manage/medium/translate'; + // @todo this will only be wired up once https://drupal.org/node/1809376 lands. + // Test if the link to translate the style 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 picture mapping listing for the translate operation. + */ + function doPictureListTest() { + $edit = array(); + $edit['label'] = $this->randomName(); + $edit['id'] = strtolower($edit['label']); + + $this->drupalPost('admin/config/media/picturemapping/add', $edit, t('Save')); + $this->assertRaw(t('Picture mapping %label saved.', array('%label' => $edit['label']))); + + // Get the picture mapping listing. + $this->drupalGet('admin/config/media/picturemapping'); + + $translate_link = 'admin/config/media/picturemapping/' . $edit['id'] . '/translate'; + // @todo Does not yet work due to https://drupal.org/node/2044865 + // Test if the link to translate the style 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() { + // Get the date format listing. + $this->drupalGet('admin/config/regional/date-time'); + + $translate_link = 'admin/config/regional/date-time/formats/manage/long/translate'; + // Test if the link to translate the format is on the page. + $this->assertLinkByHref($translate_link); + + // @todo This does not work yet due to https://drupal.org/node/2038285 + // Test if the link to translate actually goes to the translate page. + //$this->drupalGet($translate_link); + //$this->assertRaw('' . t('Language') . ''); + } + + /** * Tests a given settings page for the translate operation. * * @param string $link @@ -347,6 +409,11 @@ class ConfigTranslationListUITest extends WebTestBase { $this->doShortcutListTest(); $this->doUserRoleListTest(); $this->doLanguageListTest(); + $this->doImageStyleListTest(); + $this->doPictureListTest(); + $this->doDateFormatListTest(); + + // Views is tested in Drupal\config_translation\Tests\ConfigTranslationViewListUITest // Test the maintenance settings page. $this->doSettingsPageTest('admin/config/development/maintenance'); @@ -354,6 +421,8 @@ class ConfigTranslationListUITest extends WebTestBase { $this->doSettingsPageTest('admin/config/system/site-information'); // Test the account settings page. $this->doSettingsPageTest('admin/config/people/accounts'); + // Test the RSS settings page. + $this->doSettingsPageTest('admin/config/services/rss-publishing'); }