diff --git a/core/modules/content_translation/src/Tests/ContentTranslationOperationsTest.php b/core/modules/content_translation/src/Tests/ContentTranslationOperationsTest.php index f987494f8dfc11ca356a583d58b9006973a5c86d..522344bff733f0967cb4d56d6593c688f130955c 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationOperationsTest.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationOperationsTest.php @@ -37,8 +37,11 @@ class ContentTranslationOperationsTest extends NodeTestBase { * * @var array */ - public static $modules = ['language', 'content_translation', 'node', 'views']; + public static $modules = ['language', 'content_translation', 'node', 'views', 'block']; + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); @@ -63,7 +66,7 @@ protected function setUp() { /** * Test that the operation "Translate" is displayed in the content listing. */ - function testOperationTranslateLink() { + public function testOperationTranslateLink() { $node = $this->drupalCreateNode(['type' => 'article', 'langcode' => 'es']); // Verify no translation operation links are displayed for users without // permission. @@ -103,9 +106,30 @@ function testOperationTranslateLink() { $node->setPublished(FALSE)->save(); $this->drupalGet($node->urlInfo('drupal:content-translation-overview')); $this->assertResponse(403); + $this->drupalLogout(); + + // Ensure the 'Translate' local task does not show up anymore when disabling + // translations for a content type. + $node->setPublished(TRUE)->save(); + user_role_change_permissions( + Role::AUTHENTICATED_ID, + [ + 'administer content translation' => TRUE, + 'administer languages' => TRUE, + ] + ); + $this->drupalPlaceBlock('local_tasks_block'); + $this->drupalLogin($this->baseUser2); + $this->drupalGet('node/' . $node->id()); + $this->assertLinkByHref('node/' . $node->id() . '/translations'); + $this->drupalPostForm('admin/config/regional/content-language', ['settings[node][article][translatable]' => FALSE], t('Save configuration')); + $this->drupalGet('node/' . $node->id()); + $this->assertNoLinkByHref('node/' . $node->id() . '/translations'); } /** + * Tests the access to the overview page for translations. + * * @see content_translation_translate_access() */ public function testContentTranslationOverviewAccess() { diff --git a/core/modules/language/src/Entity/ContentLanguageSettings.php b/core/modules/language/src/Entity/ContentLanguageSettings.php index 2d9cf2812c41c81c71de2af4ba16978ca5eb5f5f..209c3b51156b87ed1210b58e5473f36ba0451257 100644 --- a/core/modules/language/src/Entity/ContentLanguageSettings.php +++ b/core/modules/language/src/Entity/ContentLanguageSettings.php @@ -24,6 +24,7 @@ * entity_keys = { * "id" = "id" * }, + * list_cache_tags = { "rendered" } * ) */ class ContentLanguageSettings extends ConfigEntityBase implements ContentLanguageSettingsInterface {