diff --git a/core/modules/config_translation/src/Form/ConfigTranslationFormBase.php b/core/modules/config_translation/src/Form/ConfigTranslationFormBase.php index c6c5d4f..9385120 100644 --- a/core/modules/config_translation/src/Form/ConfigTranslationFormBase.php +++ b/core/modules/config_translation/src/Form/ConfigTranslationFormBase.php @@ -234,7 +234,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { } /** - * Create form element builder. + * Creates a form element builder. * * @param \Drupal\Core\TypedData\TypedDataInterface $schema * Schema definition of configuration. diff --git a/core/modules/config_translation/src/FormElement/ElementInterface.php b/core/modules/config_translation/src/FormElement/ElementInterface.php index dccb982..286eeba 100644 --- a/core/modules/config_translation/src/FormElement/ElementInterface.php +++ b/core/modules/config_translation/src/FormElement/ElementInterface.php @@ -28,7 +28,7 @@ public static function create(TypedDataInterface $schema); /** - * Returns the translation build for a given configuration definition. + * Builds a render array containg the source and translation form elements. * * @param \Drupal\Core\Language\LanguageInterface $source_language * The source language of the configuration object. @@ -40,7 +40,7 @@ public static function create(TypedDataInterface $schema); * The configuration value of the element in the language to translate to. * @param array $parents * Parents array for the element in the form. - * @param string $base_key + * @param string|null $base_key * (optional) Base key to be used for the elements in the form. NULL for * top-level form elements. * @@ -53,6 +53,9 @@ public function getTranslationBuild(LanguageInterface $source_language, Language /** * Sets configuration based on a nested form value array. * + * If the configuration values are the same as the source configuration, the + * override should be removed from the translation configuration. + * * @param \Drupal\Core\Config\Config $base_config * Base configuration values, in the source language. * @param \Drupal\language\Config\LanguageConfigOverride $config_translation @@ -64,9 +67,6 @@ public function getTranslationBuild(LanguageInterface $source_language, Language * belong to. This should be NULL for the top-level configuration object and * be populated consecutively when recursing into the configuration * structure. - * - * @return array - * Translation configuration override data. */ public function setConfig(Config $base_config, LanguageConfigOverride $config_translation, $config_values, $base_key = NULL); diff --git a/core/modules/config_translation/src/FormElement/FormElementBase.php b/core/modules/config_translation/src/FormElement/FormElementBase.php index 5120138..7db01e1 100644 --- a/core/modules/config_translation/src/FormElement/FormElementBase.php +++ b/core/modules/config_translation/src/FormElement/FormElementBase.php @@ -175,9 +175,8 @@ protected function getTranslationElement(LanguageInterface $translation_language * {@inheritdoc} */ public function setConfig(Config $base_config, LanguageConfigOverride $config_translation, $config_values, $base_key = NULL) { - // Save the form configuration values, if they are different from the source - // values in the base configuration. If the form values are the same as the - // original configuration, remove the override. + // Save the configuration values, if they are different from the source + // values in the base configuration. Otherwise remove the override. if ($base_config->get($base_key) !== $config_values) { $config_translation->set($base_key, $config_values); } diff --git a/core/modules/language/src/Config/LanguageConfigCollectionNameTrait.php b/core/modules/language/src/Config/LanguageConfigCollectionNameTrait.php index 9feaf77..6f7b1ad 100644 --- a/core/modules/language/src/Config/LanguageConfigCollectionNameTrait.php +++ b/core/modules/language/src/Config/LanguageConfigCollectionNameTrait.php @@ -15,26 +15,26 @@ trait LanguageConfigCollectionNameTrait { /** - * Creates a configuration collection name based on a langcode. + * Creates a configuration collection name based on a language code. * * @param string $langcode - * The langcode. + * The language code. * * @return string - * The configuration collection name for a langcode. + * The configuration collection name for a language code. */ protected function createConfigCollectionName($langcode) { return 'language.' . $langcode; } /** - * Converts a configuration collection name to a langcode. + * Converts a configuration collection name to a language code. * * @param string $collection * The configuration collection name. * * @return string - * The langcode of the collection. + * The language code of the collection. * * @throws \InvalidArgumentException * Exception thrown if the provided collection name is not in the format