You are here

protected function YamlFormEntityElementsValidator::getElementKeysRecursive in YAML Form 8

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

Parameters

array $elements: An array of elements.

array $names: An array tracking deleted element names.

1 call to YamlFormEntityElementsValidator::getElementKeysRecursive()
YamlFormEntityElementsValidator::validateSubmissions in src/YamlFormEntityElementsValidator.php
Validate that element are not deleted when the form has submissions.

File

src/YamlFormEntityElementsValidator.php, line 286

Class

YamlFormEntityElementsValidator
Defines a class to validate form elements.

Namespace

Drupal\yamlform

Code

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