Converts the webform elements structure to translatable data.
array $source_elements: A nested webform elements structure.
array The converted data structure.
protected function convertElementsToData(array $source_elements) {
$data = [];
foreach ($source_elements as $key => $value) {
$safe_key = strtr($key, self::REPLACE_PAIRS);
if (is_array($value)) {
$data[$safe_key] = $this
->convertElementsToData($value);
$data[$safe_key]['#label'] = $key;
}
else {
$data[$safe_key] = [
// @todo Is there a better label?
'#label' => $key,
'#text' => $value,
'#translate' => $this
->isTranslatable($value),
];
}
}
return $data;
}