You are here

function clientside_validation_settings_add in Clientside Validation 7

Same name and namespace in other branches
  1. 7.2 clientside_validation.module \clientside_validation_settings_add()
3 calls to clientside_validation_settings_add()
clientside_validation_settings_form_submit in ./clientside_validation.admin.inc
clientside_validation_settings_overview_submit in ./clientside_validation.admin.inc
_clientside_validation_update_7101_save in ./clientside_validation.install

File

./clientside_validation.module, line 1447
Add client side validation to forms.

Code

function clientside_validation_settings_add($cvs_type, $cvs_formid, $settings = array(), $enable = FALSE) {
  if (!db_table_exists('clientside_validation_settings')) {
    drupal_set_message(t("You need to run the database update script so that Clientside Validation can function properly. Click !here to run the database update script.", array(
      '!here' => l('here', 'update.php'),
    )));
    return;
  }
  db_merge('clientside_validation_settings')
    ->key(array(
    'type' => $cvs_type,
    'form_id' => $cvs_formid,
  ))
    ->fields(array(
    'status' => $enable ? 1 : 0,
    'settings' => serialize($settings),
  ))
    ->execute();
}