You are here

function _clientside_validation_update_7101_save in Clientside Validation 7

Same name and namespace in other branches
  1. 7.2 clientside_validation.install \_clientside_validation_update_7101_save()
1 call to _clientside_validation_update_7101_save()
clientside_validation_update_7101 in ./clientside_validation.install
The settings for Clientside Validation were restructured and put into a separate table, This update will create this table.

File

./clientside_validation.install, line 273

Code

function _clientside_validation_update_7101_save($formid, $settings) {
  static $contenttypes;
  $saved = FALSE;
  if (!$contenttypes) {
    $contenttypes = node_type_get_types();
  }
  $formid = str_replace('-', '_', $formid);
  if (strpos($formid, 'webform_client_form_') !== FALSE) {
    $nid = str_replace('webform_client_form_', '', $formid);
    if (is_numeric($nid)) {
      clientside_validation_settings_add('webforms', $nid, $settings, TRUE);
      $saved = TRUE;
    }
  }
  if (strpos($formid, '_node_form') !== FALSE) {
    $type = str_replace('_node_form', '', $formid);
    if (is_string($type) && array_key_exists($type, $contenttypes)) {
      clientside_validation_settings_add('content-types', $type, $settings, TRUE);
      $saved = TRUE;
    }
  }
  if (!$saved) {
    clientside_validation_settings_add('custom-forms', $formid, $settings, TRUE);
  }
}