You are here

function field_validation_rule_save in Field Validation 7

Save a validation rule. Data comes from the admin form or nodeapi function in case of node clone

1 call to field_validation_rule_save()
field_validation_manage_rule_submit in ./field_validation.admin.inc
Submit handler to add / edit a rule

File

./field_validation.module, line 218

Code

function field_validation_rule_save($values) {

  // save rules data
  if ($values['action'] == 'add' || $values['action'] == 'overwrite') {
    drupal_write_record('field_validation_rule', $values);
    $ruleid = $values['ruleid'];
    if ($ruleid) {
      module_invoke_all('field_validation', 'rule', 'add', $values);
    }
  }
  if ($values['action'] == 'edit') {
    drupal_write_record('field_validation_rule', $values, 'ruleid');
    $ruleid = $values['ruleid'];
    if ($ruleid) {
      module_invoke_all('field_validation', 'rule', 'edit', $values);
    }
  }
}