diff --git a/core/lib/Drupal/Core/Config/TypedConfigManagerInterface.php b/core/lib/Drupal/Core/Config/TypedConfigManagerInterface.php index a1f2c98..84d347b 100644 --- a/core/lib/Drupal/Core/Config/TypedConfigManagerInterface.php +++ b/core/lib/Drupal/Core/Config/TypedConfigManagerInterface.php @@ -24,7 +24,7 @@ * @param string $name * Configuration object name. * - * @return \Drupal\Core\Config\Schema\ArrayElement + * @return \Drupal\Core\TypedData\TraversableTypedDataInterface * Typed configuration element. */ public function get($name); diff --git a/core/modules/config_translation/src/Form/ConfigTranslationFormBase.php b/core/modules/config_translation/src/Form/ConfigTranslationFormBase.php index 9ccb2e7..98fd84e 100644 --- a/core/modules/config_translation/src/Form/ConfigTranslationFormBase.php +++ b/core/modules/config_translation/src/Form/ConfigTranslationFormBase.php @@ -8,7 +8,6 @@ namespace Drupal\config_translation\Form; use Drupal\config_translation\ConfigMapperManagerInterface; -use Drupal\Core\Config\Schema\ArrayElement; use Drupal\Core\Config\TypedConfigManagerInterface; use Drupal\Core\TypedData\TypedDataInterface; use Drupal\Core\Form\BaseFormIdInterface; diff --git a/core/modules/config_translation/src/FormElement/ListElement.php b/core/modules/config_translation/src/FormElement/ListElement.php index 7867377..3481a0f 100644 --- a/core/modules/config_translation/src/FormElement/ListElement.php +++ b/core/modules/config_translation/src/FormElement/ListElement.php @@ -9,10 +9,10 @@ use Drupal\Core\Config\Config; use Drupal\Core\Language\LanguageInterface; -use Drupal\Core\Config\Schema\ArrayElement; use Drupal\config_translation\Form\ConfigTranslationFormBase; use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\TypedData\DataDefinitionInterface; +use Drupal\Core\TypedData\TraversableTypedDataInterface; use Drupal\Core\TypedData\TypedDataInterface; use Drupal\language\Config\LanguageConfigOverride; @@ -26,17 +26,17 @@ class ListElement implements ElementInterface { /** * The schema element this form is for. * - * @var \Drupal\Core\Config\Schema\ArrayElement + * @var \Drupal\Core\TypedData\TraversableTypedDataInterface */ protected $element; /** - * Constructs a FormElementBase. + * Constructs a ListElement. * - * @param \Drupal\Core\Config\Schema\ArrayElement $element + * @param \Drupal\Core\TypedData\TraversableTypedDataInterface $element * The schema element this form element is for. */ - public function __construct(ArrayElement $element) { + public function __construct(TraversableTypedDataInterface $element) { $this->element = $element; } @@ -58,24 +58,7 @@ public function getTranslationBuild(LanguageInterface $source_language, Language $element_key = implode('.', array_filter(array($base_key, $key))); $definition = $element->getDataDefinition(); - // If this element is translatable, show a translation form. This may be a - // simple element, as is the case for unformatted text or date formats, or - // an array element, as is the case for formatted text. In the latter case - // the form element class is responsible for handling input for all - // configuration values contained in the element. - - // If this is a non-translatable array element, traverse the schema - // further. - if ($form_element = ConfigTranslationFormBase::createFormElement($element)) { - // For accessibility we make source and translation appear next to each - // other in the source for each element, which is why we utilize the - // 'source' and 'translation' sub-keys for the form. The form values, - // however, should mirror the configuration structure, so that we can - // traverse the configuration schema and still access the right - // configuration values in ConfigTranslationFormBase::setConfig(). - // Therefore we make the 'source' and 'translation' keys the top-level - // keys in $form_state['values']. $element_parents = array_merge($parents, array($key)); $sub_build += $form_element->getTranslationBuild($source_language, $translation_language, $source_config[$key], $translation_config[$key], $element_parents, $element_key); @@ -86,7 +69,7 @@ public function getTranslationBuild(LanguageInterface $source_language, Language // Build sub-structure and include it with a wrapper in the form // if there are any translatable elements there. $build[$key] = array(); - if ($element instanceof ArrayElement) { + if ($element instanceof TraversableTypedDataInterface) { $build[$key] = array( '#type' => 'details', '#title' => $this->getGroupTitle($definition, $sub_build), diff --git a/core/modules/locale/src/LocaleConfigSubscriber.php b/core/modules/locale/src/LocaleConfigSubscriber.php index fdf4bff..b34d556 100644 --- a/core/modules/locale/src/LocaleConfigSubscriber.php +++ b/core/modules/locale/src/LocaleConfigSubscriber.php @@ -10,7 +10,7 @@ use Drupal\Core\Config\ConfigEvents; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Config\ConfigOverrideCrudEvent; -use Drupal\Core\Config\Schema\ArrayElement; +use Drupal\Core\TypedData\TraversableTypedDataInterface; use Drupal\language\Config\LanguageConfigOverride; use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -108,7 +108,7 @@ public function onOverrideUpdate(ConfigOverrideCrudEvent $event) { * The source configuration. * @param \Drupal\language\Config\LanguageConfigOverride $translation_config * The language configuration override. - * @param \Drupal\Core\Config\Schema\ArrayElement $schema + * @param \Drupal\Core\TypedData\TraversableTypedDataInterface $schema * The respective configuration schema. * @param string|null $base_key * (optional) The base key that the schema and the configuration values @@ -116,13 +116,13 @@ public function onOverrideUpdate(ConfigOverrideCrudEvent $event) { * be populated consecutively when recursing into the configuration * structure. */ - protected function saveStrings(Config $source_config, LanguageConfigOverride $translation_config, ArrayElement $schema, $base_key = NULL) { + protected function saveStrings(Config $source_config, LanguageConfigOverride $translation_config, TraversableTypedDataInterface $schema, $base_key = NULL) { foreach ($schema as $key => $element) { $element_key = implode('.', array_filter(array($base_key, $key))); // We only care for strings here, so traverse the schema further in the // case of array elements. - if ($element instanceof ArrayElement) { + if ($element instanceof TraversableTypedDataInterface) { $this->saveStrings($source_config, $translation_config, $element, $element_key); } else {