You are here

protected function WebformTranslationConfigManager::mergeTranslationAndSourceElementsProperties in Webform 6.x

Merge translation and source element properties.

Parameters

array $translation_elements: An array of elements.

array $source_elements: An array of elements to be merged.

File

src/WebformTranslationConfigManager.php, line 1024

Class

WebformTranslationConfigManager
Defines a class to translate webform config.

Namespace

Drupal\webform

Code

protected function mergeTranslationAndSourceElementsProperties(array &$translation_elements, array $source_elements) {
  foreach ($translation_elements as $key => &$translation_element) {
    if (!isset($source_elements[$key])) {
      continue;
    }
    $source_element = $source_elements[$key];
    if ($translation_element === $source_element) {
      unset($translation_elements[$key]);
    }
    elseif (is_array($translation_element) && is_array($source_element)) {
      $this
        ->mergeTranslationAndSourceElementsProperties($translation_element, $source_element);
      if (empty($translation_element)) {
        unset($translation_elements[$key]);
      }
    }
  }
}