You are here

function webform_validation_get_field_keys in Webform Validation 7

Same name and namespace in other branches
  1. 6 webform_validation.module \webform_validation_get_field_keys()

Helper function to get all field keys (including fields in fieldsets).

Deprecated

in webform_validation:7.x-1.14 and is removed from webform_validation:7.x-2.0. No longer used.

See also

https://www.drupal.org/project/webform_validation/issues/2841817

File

./webform_validation.module, line 292

Code

function webform_validation_get_field_keys($submitted, $node) {
  static $fields = array();
  foreach (element_children($submitted) as $child) {
    if (is_array($submitted[$child]) && element_children($submitted[$child])) {

      // Only keep searching recursively if it's a fieldset.
      $group_components = _webform_validation_get_group_types();
      if (in_array(_webform_validation_get_component_type($node, $child), $group_components)) {
        webform_validation_get_field_keys($submitted[$child], $node);
      }
      else {
        $fields[$child] = $child;
      }
    }
    else {
      $fields[$child] = $child;
    }
  }
  return $fields;
}