Error message

Warning: count(): Parameter must be an array or an object that implements Countable in _api_make_match_member_link() (line 1230 of /home/projects/api/www/sites/all/modules/api/api.formatting.inc).

public function DefaultConfigProcessor::convertToTranslation

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'];
  }
}