diff --git a/core/modules/content_translation/content_translation.install b/core/modules/content_translation/content_translation.install index c8c47d9befe624fe909588aa56ed9b882b4b0bc2..690ad2ba29609a5ec649b340339b16d9b966f8d7 100644 --- a/core/modules/content_translation/content_translation.install +++ b/core/modules/content_translation/content_translation.install @@ -5,6 +5,8 @@ * Installation functions for Content Translation module. */ +use \Drupal\Core\Url; + /** * Implements hook_install(). */ @@ -12,20 +14,15 @@ function content_translation_install() { // Assign a fairly low weight to ensure our implementation of // hook_module_implements_alter() is run among the last ones. module_set_weight('content_translation', 10); -} - -/** - * Implements hook_enable(). - */ -function content_translation_enable() { // Translation works when at least two languages are added. if (count(\Drupal::languageManager()->getLanguages()) < 2) { - $t_args = array(':language_url' => \Drupal::url('entity.configurable_language.collection')); + // @todo: Switch to Url::fromRoute() once https://www.drupal.org/node/2589967 is resolved. + $t_args = [':language_url' => Url::fromUri('internal:/admin/config/regional/language')->toString()]; $message = t('This site has only a single language enabled. <a href=":language_url">Add at least one more language</a> in order to translate content.', $t_args); drupal_set_message($message, 'warning'); } // Point the user to the content translation settings. - $t_args = array(':settings_url' => \Drupal::url('language.content_settings_page')); + $t_args = [':settings_url' => Url::fromUri('internal:/admin/config/regional/content-language')->toString()]; $message = t('<a href=":settings_url">Enable translation</a> for <em>content types</em>, <em>taxonomy vocabularies</em>, <em>accounts</em>, or any other element you wish to translate.', $t_args); drupal_set_message($message, 'warning'); } diff --git a/core/modules/content_translation/src/Tests/ContentTranslationEnableTest.php b/core/modules/content_translation/src/Tests/ContentTranslationEnableTest.php index 926a60e4a840dac13831fce85e7035f15c4f7c31..906ccd1863ca3bdca4c4da3e3a482a4568d982be 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationEnableTest.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationEnableTest.php @@ -10,7 +10,7 @@ use Drupal\simpletest\WebTestBase; /** - * Test enabling content translation after other modules. + * Test enabling content translation module. * * @group content_translation */ @@ -34,6 +34,10 @@ public function testEnable() { ]; $this->drupalPostForm('admin/modules', $edit, t('Install')); + // Status messages are shown. + $this->assertText(t('This site has only a single language enabled. Add at least one more language in order to translate content.')); + $this->assertText(t('Enable translation for content types, taxonomy vocabularies, accounts, or any other element you wish to translate.')); + // No pending updates should be available. $this->drupalGet('admin/reports/status'); $requirement_value = $this->cssSelect("tr.system-status-report__entry th:contains('Entity/field definitions') + td"); diff --git a/core/modules/help/src/Tests/HelpEmptyPageTest.php b/core/modules/help/src/Tests/HelpEmptyPageTest.php index e0c1f35fad9c3593e9660a647c68ea3044fcdee2..15e769adeb6425cf47e0455ecb23590d3abc0dd3 100644 --- a/core/modules/help/src/Tests/HelpEmptyPageTest.php +++ b/core/modules/help/src/Tests/HelpEmptyPageTest.php @@ -47,7 +47,8 @@ public function testEmptyHookHelp() { return TRUE; }); - \Drupal::service('module_installer')->install(array_keys($all_modules)); + $this->enableModules(array_keys($all_modules)); + $this->installEntitySchema('menu_link_content'); $route = \Drupal::service('router.route_provider')->getRouteByName('<front>'); \Drupal::service('module_handler')->invokeAll('help', ['<front>', new RouteMatch('<front>', $route)]);