diff --git a/core/modules/comment/src/Tests/CommentTranslationUITest.php b/core/modules/comment/src/Tests/CommentTranslationUITest.php index f6e1287..945e532 100644 --- a/core/modules/comment/src/Tests/CommentTranslationUITest.php +++ b/core/modules/comment/src/Tests/CommentTranslationUITest.php @@ -53,7 +53,7 @@ function setupBundle() { // translatable. $this->container->get('comment.manager')->addDefaultField('node', 'page', 'comment'); // Mark this bundle as translatable. - $this->container->get('content_translation.manager')->enable('comment', 'comment_article'); + $this->container->get('content_translation.manager')->setEnabled('comment', 'comment_article', TRUE); } /** diff --git a/core/modules/content_translation/config/schema/content_translation.schema.yml b/core/modules/content_translation/config/schema/content_translation.schema.yml index f404154..1e724d8 100644 --- a/core/modules/content_translation/config/schema/content_translation.schema.yml +++ b/core/modules/content_translation/config/schema/content_translation.schema.yml @@ -10,7 +10,8 @@ field_config.third_party.content_translation: sequence: - type: string label: 'Field column for which to synchronize translations' -content_settings.third_party.content_translation: + +language.content_settings.third_party.content_translation: type: mapping label: 'Content translation content settings' mapping: diff --git a/core/modules/content_translation/content_translation.admin.inc b/core/modules/content_translation/content_translation.admin.inc index 84e08fb..d812652 100644 --- a/core/modules/content_translation/content_translation.admin.inc +++ b/core/modules/content_translation/content_translation.admin.inc @@ -72,9 +72,10 @@ function _content_translation_form_language_content_settings_form_alter(array &$ return; } + $content_translation_manager = \Drupal::service('content_translation.manager'); $default = $form['entity_types']['#default_value']; foreach ($default as $entity_type_id => $enabled) { - $default[$entity_type_id] = $enabled || \Drupal::service('content_translation.manager')->isEnabled($entity_type_id) ? $entity_type_id : FALSE; + $default[$entity_type_id] = $enabled || $content_translation_manager->isEnabled($entity_type_id) ? $entity_type_id : FALSE; } $form['entity_types']['#default_value'] = $default; @@ -118,7 +119,7 @@ function _content_translation_form_language_content_settings_form_alter(array &$ // entity might have fields and if there are fields to translate. $form['settings'][$entity_type_id][$bundle]['translatable'] = array( '#type' => 'checkbox', - '#default_value' => \Drupal::service('content_translation.manager')->isEnabled($entity_type_id, $bundle), + '#default_value' => $content_translation_manager->isEnabled($entity_type_id, $bundle), ); } } diff --git a/core/modules/content_translation/src/ContentTranslationManager.php b/core/modules/content_translation/src/ContentTranslationManager.php index c26b929..03eb69f 100644 --- a/core/modules/content_translation/src/ContentTranslationManager.php +++ b/core/modules/content_translation/src/ContentTranslationManager.php @@ -56,26 +56,11 @@ public function getSupportedEntityTypes() { /** * {@inheritdoc} */ - public function enable($entity_type_id, $bundle) { - $this->setEnabled($entity_type_id, $bundle, TRUE); - } - - /** - * {@inheritdoc} - */ - public function disable($entity_type_id, $bundle) { - $this->setEnabled($entity_type_id, $bundle, FALSE); - } - - /** - * {@inheritdoc} - */ public function setEnabled($entity_type_id, $bundle, $value) { $config = ContentLanguageSettings::loadByEntityTypeBundle($entity_type_id, $bundle); $config->setThirdPartySetting('content_translation', 'enabled', $value)->save(); } - /** * {@inheritdoc} */ diff --git a/core/modules/content_translation/src/ContentTranslationManagerInterface.php b/core/modules/content_translation/src/ContentTranslationManagerInterface.php index fb02852..e3ae29f 100644 --- a/core/modules/content_translation/src/ContentTranslationManagerInterface.php +++ b/core/modules/content_translation/src/ContentTranslationManagerInterface.php @@ -32,26 +32,6 @@ public function getSupportedEntityTypes(); public function isSupported($entity_type_id); /** - * Enables translatability of the given entity type bundle. - * - * @param string $entity_type_id - * The entity type. - * @param string $bundle - * The bundle of the entity. - */ - public function enable($entity_type_id, $bundle); - - /** - * Disables translatability of the given entity type bundle. - * - * @param string $entity_type_id - * The entity type. - * @param string $bundle - * The bundle of the entity. - */ - public function disable($entity_type_id, $bundle); - - /** * Sets the value for translatability of the given entity type bundle. * * @param string $entity_type_id diff --git a/core/modules/content_translation/src/ContentTranslationPermissions.php b/core/modules/content_translation/src/ContentTranslationPermissions.php index 53ba4d7..b1ff68a 100644 --- a/core/modules/content_translation/src/ContentTranslationPermissions.php +++ b/core/modules/content_translation/src/ContentTranslationPermissions.php @@ -40,7 +40,7 @@ class ContentTranslationPermissions implements ContainerInjectionInterface { * The entity manager. * @param \Drupal\content_translation\ContentTranslationManagerInterface $content_translation_manager * The content translation manager. -s */ + */ public function __construct(EntityManagerInterface $entity_manager, ContentTranslationManagerInterface $content_translation_manager) { $this->entityManager = $entity_manager; $this->contentTranslationManager = $content_translation_manager; diff --git a/core/modules/content_translation/src/Tests/ContentTranslationContextualLinksTest.php b/core/modules/content_translation/src/Tests/ContentTranslationContextualLinksTest.php index 655286f..1dfec07 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationContextualLinksTest.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationContextualLinksTest.php @@ -74,7 +74,7 @@ protected function setUp() { // Enable translation for the current entity type and ensure the change is // picked up. - \Drupal::service('content_translation.manager')->enable('node', $this->bundle); + \Drupal::service('content_translation.manager')->setEnabled('node', $this->bundle, TRUE); drupal_static_reset(); \Drupal::entityManager()->clearCachedBundles(); \Drupal::service('router.builder')->rebuild(); diff --git a/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php b/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php index 61968d2..dda1ff2 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php @@ -163,7 +163,7 @@ protected function setupBundle() { protected function enableTranslation() { // Enable translation for the current entity type and ensure the change is // picked up. - \Drupal::service('content_translation.manager')->enable($this->entityTypeId, $this->bundle); + \Drupal::service('content_translation.manager')->setEnabled($this->entityTypeId, $this->bundle, TRUE); drupal_static_reset(); \Drupal::entityManager()->clearCachedDefinitions(); \Drupal::service('router.builder')->rebuild(); diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceFieldTranslatedReferenceViewTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceFieldTranslatedReferenceViewTest.php index aafb654..8480073 100644 --- a/core/modules/entity_reference/src/Tests/EntityReferenceFieldTranslatedReferenceViewTest.php +++ b/core/modules/entity_reference/src/Tests/EntityReferenceFieldTranslatedReferenceViewTest.php @@ -166,8 +166,8 @@ protected function createContent() { protected function enableTranslation() { // Enable translation for the entity types and ensure the change is picked // up. - \Drupal::service('content_translation.manager')->enable($this->testEntityTypeName, $this->referrerType->id()); - \Drupal::service('content_translation.manager')->enable($this->testEntityTypeName, $this->referencedType->id()); + \Drupal::service('content_translation.manager')->setEnabled($this->testEntityTypeName, $this->referrerType->id(), TRUE); + \Drupal::service('content_translation.manager')->setEnabled($this->testEntityTypeName, $this->referencedType->id(), TRUE); drupal_static_reset(); \Drupal::entityManager()->clearCachedDefinitions(); \Drupal::service('router.builder')->rebuild(); diff --git a/core/modules/language/config/schema/language.schema.yml b/core/modules/language/config/schema/language.schema.yml index 24025f2..d894eb6 100644 --- a/core/modules/language/config/schema/language.schema.yml +++ b/core/modules/language/config/schema/language.schema.yml @@ -124,7 +124,7 @@ language.content_settings.*.*: type: sequence label: 'Third party settings' sequence: - - type: content_settings.third_party.[%key] + - type: language.content_settings.third_party.[%key] condition.plugin.language: type: condition.plugin diff --git a/core/modules/taxonomy/src/Tests/TermTranslationFieldViewTest.php b/core/modules/taxonomy/src/Tests/TermTranslationFieldViewTest.php index 32518fd..fc3267c 100644 --- a/core/modules/taxonomy/src/Tests/TermTranslationFieldViewTest.php +++ b/core/modules/taxonomy/src/Tests/TermTranslationFieldViewTest.php @@ -139,8 +139,8 @@ protected function setUpNode() { protected function enableTranslation() { // Enable translation for the current entity type and ensure the change is // picked up. - \Drupal::service('content_translation.manager')->enable('node', 'article'); - \Drupal::service('content_translation.manager')->enable('taxonomy_vocabulary', $this->vocabulary->id()); + \Drupal::service('content_translation.manager')->setEnabled('node', 'article', TRUE); + \Drupal::service('content_translation.manager')->setEnabled('taxonomy_vocabulary', $this->vocabulary->id(), TRUE); drupal_static_reset(); \Drupal::entityManager()->clearCachedDefinitions(); \Drupal::service('router.builder')->rebuild(); diff --git a/core/modules/taxonomy/src/Tests/Views/TaxonomyTermViewTest.php b/core/modules/taxonomy/src/Tests/Views/TaxonomyTermViewTest.php index 2918eac..5899705 100644 --- a/core/modules/taxonomy/src/Tests/Views/TaxonomyTermViewTest.php +++ b/core/modules/taxonomy/src/Tests/Views/TaxonomyTermViewTest.php @@ -96,7 +96,7 @@ public function testTaxonomyTermView() { $language->save(); // Enable translation for the article content type and ensure the change is // picked up. - \Drupal::service('content_translation.manager')->enable('node', 'article'); + \Drupal::service('content_translation.manager')->setEnabled('node', 'article', TRUE); $roles = $this->admin_user->getRoles(TRUE); Role::load(reset($roles)) ->grantPermission('create content translations')