You are here

protected function WebformTranslationConfigManager::getElementsFlattened in Webform 6.x

Flatten a nested array of elements.

Parameters

array $elements: An array of elements.

Return value

array A flattened array of elements.

1 call to WebformTranslationConfigManager::getElementsFlattened()
WebformTranslationConfigManager::getWebformElementProperties in src/WebformTranslationConfigManager.php
Get flattened webform element properties from the webform_ui.module.

File

src/WebformTranslationConfigManager.php, line 953

Class

WebformTranslationConfigManager
Defines a class to translate webform config.

Namespace

Drupal\webform

Code

protected function getElementsFlattened(array $elements) {
  $flattened_elements = [];
  foreach ($elements as $key => &$element) {
    if (!WebformElementHelper::isElement($element, $key)) {
      continue;
    }
    if (isset($element['#type']) && !in_array($element['#type'], [
      'fieldset',
      'details',
    ])) {
      $flattened_elements[$key] = WebformElementHelper::getProperties($element);
    }
    $flattened_elements += $this
      ->getElementsFlattened($element);
  }
  return $flattened_elements;
}