diff --git a/core/modules/content_translation/content_translation.admin.inc b/core/modules/content_translation/content_translation.admin.inc index d71b150b90..f157749a90 100644 --- a/core/modules/content_translation/content_translation.admin.inc +++ b/core/modules/content_translation/content_translation.admin.inc @@ -5,7 +5,7 @@ * The content translation administration forms. */ -use Drupal\content_translation\BundleSettingsInterface; +use Drupal\content_translation\BundleTranslationSettingsInterface; use Drupal\Core\Config\Entity\ThirdPartySettingsInterface; use Drupal\Core\Entity\ContentEntityTypeInterface; use Drupal\Core\Entity\EntityTypeInterface; @@ -113,8 +113,8 @@ function _content_translation_form_language_content_settings_form_alter(array &$ } // Displayed the "shared fields widgets" toggle. - if ($content_translation_manager instanceof BundleSettingsInterface) { - $settings = $content_translation_manager->getBundleSettings($entity_type_id, $bundle); + if ($content_translation_manager instanceof BundleTranslationSettingsInterface) { + $settings = $content_translation_manager->getBundleTranslationSettings($entity_type_id, $bundle); $form['settings'][$entity_type_id][$bundle]['settings']['content_translation']['untranslatable_fields_hide'] = [ '#type' => 'checkbox', '#title' => t('Hide non translatable fields on translation forms'), @@ -371,8 +371,8 @@ function content_translation_form_language_content_settings_submit(array $form, $content_translation_manager->setEnabled($entity_type_id, $bundle, $bundle_settings['translatable']); // Store any other bundle settings. - if ($content_translation_manager instanceof BundleSettingsInterface) { - $content_translation_manager->setBundleSettings($entity_type_id, $bundle, $bundle_settings['settings']['content_translation']); + if ($content_translation_manager instanceof BundleTranslationSettingsInterface) { + $content_translation_manager->setBundleTranslationSettings($entity_type_id, $bundle, $bundle_settings['settings']['content_translation']); } // Save translation_sync settings. diff --git a/core/modules/content_translation/content_translation.module b/core/modules/content_translation/content_translation.module index b0038eca18..48feccc6cd 100644 --- a/core/modules/content_translation/content_translation.module +++ b/core/modules/content_translation/content_translation.module @@ -5,7 +5,7 @@ * Allows entities to be translated into different languages. */ -use Drupal\content_translation\BundleSettingsInterface; +use Drupal\content_translation\BundleTranslationSettingsInterface; use Drupal\Core\Access\AccessResult; use Drupal\Core\Entity\ContentEntityFormInterface; use Drupal\Core\Entity\ContentEntityInterface; @@ -167,8 +167,8 @@ function content_translation_entity_bundle_info_alter(&$bundles) { foreach ($bundles as $entity_type_id => &$info) { foreach ($info as $bundle => &$bundle_info) { $bundle_info['translatable'] = $content_translation_manager->isEnabled($entity_type_id, $bundle); - if ($content_translation_manager instanceof BundleSettingsInterface) { - $settings = $content_translation_manager->getBundleSettings($entity_type_id, $bundle); + if ($content_translation_manager instanceof BundleTranslationSettingsInterface) { + $settings = $content_translation_manager->getBundleTranslationSettings($entity_type_id, $bundle); $bundle_info['untranslatable_fields.default_translation_affected'] = !empty($settings['untranslatable_fields_hide']); } } diff --git a/core/modules/content_translation/src/BundleSettingsInterface.php b/core/modules/content_translation/src/BundleTranslationSettingsInterface.php similarity index 63% rename from core/modules/content_translation/src/BundleSettingsInterface.php rename to core/modules/content_translation/src/BundleTranslationSettingsInterface.php index f02522927e..b6bf89299e 100644 --- a/core/modules/content_translation/src/BundleSettingsInterface.php +++ b/core/modules/content_translation/src/BundleTranslationSettingsInterface.php @@ -5,10 +5,10 @@ /** * Interface providing support for content translation bundle settings. */ -interface BundleSettingsInterface { +interface BundleTranslationSettingsInterface { /** - * Returns settings for the specified bundle. + * Returns translation settings for the specified bundle. * * @param string $entity_type_id * The entity type identifier. @@ -18,10 +18,10 @@ * @return array * An associative array of values keyed by setting name. */ - public function getBundleSettings($entity_type_id, $bundle); + public function getBundleTranslationSettings($entity_type_id, $bundle); /** - * Sets settings for the specified bundle. + * Sets translation settings for the specified bundle. * * @param array $settings * An associative array of values keyed by setting name. @@ -30,6 +30,6 @@ public function getBundleSettings($entity_type_id, $bundle); * @param string $bundle * The bundle name. */ - public function setBundleSettings($entity_type_id, $bundle, array $settings); + public function setBundleTranslationSettings($entity_type_id, $bundle, array $settings); } diff --git a/core/modules/content_translation/src/ContentTranslationHandler.php b/core/modules/content_translation/src/ContentTranslationHandler.php index 71e9ba86f9..cb6776f0e5 100644 --- a/core/modules/content_translation/src/ContentTranslationHandler.php +++ b/core/modules/content_translation/src/ContentTranslationHandler.php @@ -119,7 +119,7 @@ public static function createInstance(ContainerInterface $container, EntityTypeI $container->get('content_translation.manager'), $container->get('entity.manager'), $container->get('current_user'), - \Drupal::messenger() + $container->get('messenger') ); } @@ -541,7 +541,7 @@ public function entityFormSharedElements($element, FormStateInterface $form_stat $display_warning = FALSE; // We use field definitions to identify untranslatable field widgets to be - // hidden. Field that are not involved in translation changes checks should + // hidden. Fields that are not involved in translation changes checks should // not be affected by this logic (the "revision_log" field, for instance). $field_definitions = array_diff_key($entity->getFieldDefinitions(), array_flip($this->getFieldsToSkipFromTranslationChangesCheck($entity))); diff --git a/core/modules/content_translation/src/ContentTranslationManager.php b/core/modules/content_translation/src/ContentTranslationManager.php index 28acd42815..8b3831a251 100644 --- a/core/modules/content_translation/src/ContentTranslationManager.php +++ b/core/modules/content_translation/src/ContentTranslationManager.php @@ -8,7 +8,7 @@ /** * Provides common functionality for content translation. */ -class ContentTranslationManager implements ContentTranslationManagerInterface, BundleSettingsInterface { +class ContentTranslationManager implements ContentTranslationManagerInterface, BundleTranslationSettingsInterface { /** * The entity type manager. @@ -108,7 +108,7 @@ public function isEnabled($entity_type_id, $bundle = NULL) { /** * {@inheritdoc} */ - public function setBundleSettings($entity_type_id, $bundle, array $settings) { + public function setBundleTranslationSettings($entity_type_id, $bundle, array $settings) { $config = $this->loadContentLanguageSettings($entity_type_id, $bundle); $config->setThirdPartySetting('content_translation', 'bundle_settings', $settings) ->save(); @@ -117,7 +117,7 @@ public function setBundleSettings($entity_type_id, $bundle, array $settings) { /** * {@inheritdoc} */ - public function getBundleSettings($entity_type_id, $bundle) { + public function getBundleTranslationSettings($entity_type_id, $bundle) { $config = $this->loadContentLanguageSettings($entity_type_id, $bundle); return $config->getThirdPartySetting('content_translation', 'bundle_settings', []); } diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityDecoupledTranslationRevisionsTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityDecoupledTranslationRevisionsTest.php index 5270d39384..d2e30d2741 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityDecoupledTranslationRevisionsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityDecoupledTranslationRevisionsTest.php @@ -385,7 +385,7 @@ protected function doEditStep($active_langcode, $default_revision, $untranslatab elseif (!$entity->isDefaultTranslation()) { /** @var \Drupal\Core\Entity\ContentEntityInterface $default_revision */ $default_revision = $this->storage->loadUnchanged($entity->id()); - $expected_value = $default_revision->get('not_translatable')->value; + $expected_value = $default_revision->get('non_mul_field')->value; $this->assertEquals($expected_value, $value, $this->formatMessage('Loaded untranslatable field value does not match the previous one.')); }