You are here

protected function WebformEntityElementsValidator::getElementKeysRecursive in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/WebformEntityElementsValidator.php \Drupal\webform\WebformEntityElementsValidator::getElementKeysRecursive()

Recurse through elements and collect an associative array of deleted element keys.

Parameters

array $elements: An array of elements.

array $names: An array tracking deleted element keys.

3 calls to WebformEntityElementsValidator::getElementKeysRecursive()
WebformEntityElementsValidator::validate in src/WebformEntityElementsValidator.php
Validate webform elements.
WebformEntityElementsValidator::validateSubmissions in src/WebformEntityElementsValidator.php
Validate that element are not deleted when the webform has submissions.
WebformEntityElementsValidator::validateVariants in src/WebformEntityElementsValidator.php
Validate that element are not deleted when the webform has related variants.

File

src/WebformEntityElementsValidator.php, line 614

Class

WebformEntityElementsValidator
Webform elements validator.

Namespace

Drupal\webform

Code

protected function getElementKeysRecursive(array $elements, array &$names) {
  foreach ($elements as $key => &$element) {
    if (!WebformElementHelper::isElement($element, $key)) {
      continue;
    }
    if (isset($element['#type'])) {
      $names[$key] = $key;
    }
    $this
      ->getElementKeysRecursive($element, $names);
  }
}