You are here

function webform_validation_get_webform_components in Webform Validation 7

Same name and namespace in other branches
  1. 6 webform_validation.admin.inc \webform_validation_get_webform_components()

Get a filtered list of components for a specific webform.

List is filtered by the validator settings.

1 call to webform_validation_get_webform_components()
webform_validation_manage_rule in ./webform_validation.admin.inc
Callback function to add or edit a validation rule.

File

./webform_validation.admin.inc, line 343
Manages validation rules administration UI.

Code

function webform_validation_get_webform_components($node, $validator) {
  form_load_include($form_state, 'inc', 'webform', 'includes/webform.components');
  $ret = array();
  $components = $node->webform['components'];
  if ($components) {
    $valid_components = webform_validation_valid_component_types($validator);
    $component_names = webform_component_list($node, NULL, 'path');
    foreach ($components as $cid => $component) {
      if (in_array($component['type'], $valid_components)) {
        $ret[$cid] = $component_names[$cid];
      }
    }
  }
  return $ret;
}