You are here

protected static function WebformMultiple::setElementRowParentsRecursive in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Element/WebformMultiple.php \Drupal\webform\Element\WebformMultiple::setElementRowParentsRecursive()

Set element row parents recursively.

This allow elements/columns to contain nested sub-elements.

Parameters

array $element: The child element.

string $element_key: The child element's key.

array $parents: The main element's parents.

1 call to WebformMultiple::setElementRowParentsRecursive()
WebformMultiple::buildElementRow in src/Element/WebformMultiple.php
Build a single element row.

File

src/Element/WebformMultiple.php, line 778

Class

WebformMultiple
Provides a webform element to assist in creation of multiple elements.

Namespace

Drupal\webform\Element

Code

protected static function setElementRowParentsRecursive(array &$element, $element_key, array $parents) {
  $element['#parents'] = array_merge($parents, [
    $element_key,
  ]);
  foreach (Element::children($element) as $child_key) {
    static::setElementRowParentsRecursive($element[$child_key], $child_key, $parents);
  }
}