You are here

public static function WebformElementHelper::getFlattened in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Utility/WebformElementHelper.php \Drupal\webform\Utility\WebformElementHelper::getFlattened()

Flatten a nested array of elements.

Parameters

array $elements: An array of elements.

Return value

array A flattened array of elements.

7 calls to WebformElementHelper::getFlattened()
Webform::postSave in src/Entity/Webform.php
Acts on a saved entity before the insert or update hook is invoked.
WebformCompositeBase::getManagedFiles in src/Plugin/WebformElement/WebformCompositeBase.php
Get composite's managed file elements.
WebformCompositeBase::getTestValues in src/Plugin/WebformElement/WebformCompositeBase.php
Get test values for an element.
WebformCompositeBase::validateWebformComposite in src/Element/WebformCompositeBase.php
Validates a composite element.
WebformCompositeBase::valueCallback in src/Element/WebformCompositeBase.php
Determines how user input is mapped to an element's #value property.

... See full list

File

src/Utility/WebformElementHelper.php, line 586

Class

WebformElementHelper
Helper class webform element methods.

Namespace

Drupal\webform\Utility

Code

public static function getFlattened(array $elements) {
  $flattened_elements = [];
  foreach ($elements as $key => &$element) {
    if (!self::isElement($element, $key)) {
      continue;
    }
    $flattened_elements[$key] = self::getProperties($element);
    $flattened_elements += self::getFlattened($element);
  }
  return $flattened_elements;
}