You are here

function webform_validation_save_rule_components in Webform Validation 7

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

Save components attached to a specific rule.

Parameters

int $ruleid: The ruleid of the rule being saved.

array $components: An array in which the keys are the cid's of the components attached to the rule.

Return value

array An array of the return statuses for each query keyed by cid.

1 call to webform_validation_save_rule_components()
webform_validation_rule_save in ./webform_validation.module
Save a validation rule.

File

./webform_validation.module, line 530

Code

function webform_validation_save_rule_components($ruleid, array $components) {
  $return_status = array();
  foreach ($components as $cid => $component) {
    $return_status[$cid] = db_merge('webform_validation_rule_components')
      ->key(array(
      'ruleid' => $ruleid,
      'cid' => $cid,
    ))
      ->fields(array(
      'ruleid' => $ruleid,
      'cid' => $cid,
    ))
      ->execute();
  }
  return $return_status;
}