You are here

public function DefaultConfigProcessor::convertToTranslation in Translation Management Tool 8

Converts a translated data structure.

Parameters

array $data: The translated data structure.

Return value

array Returns a translation array as expected by \Drupal\config_translation\FormElement\ElementInterface::setConfig().

Overrides ConfigProcessorInterface::convertToTranslation

1 call to DefaultConfigProcessor::convertToTranslation()
WebformConfigProcessor::convertToTranslation in sources/tmgmt_config/src/WebformConfigProcessor.php
Converts a translated data structure.
1 method overrides DefaultConfigProcessor::convertToTranslation()
WebformConfigProcessor::convertToTranslation in sources/tmgmt_config/src/WebformConfigProcessor.php
Converts a translated data structure.

File

sources/tmgmt_config/src/DefaultConfigProcessor.php, line 62

Class

DefaultConfigProcessor
Default implementation of the config processor.

Namespace

Drupal\tmgmt_config

Code

public function convertToTranslation($data) {
  $children = Element::children($data);
  if ($children) {
    $translation = [];
    foreach ($children as $name) {
      $property_data = $data[$name];
      $translation[$name] = $this
        ->convertToTranslation($property_data);
    }
    return $translation;
  }
  elseif (isset($data['#translation']['#text'])) {
    return $data['#translation']['#text'];
  }
}