function _formdefaults_save_form in Form Defaults 7
Same name and namespace in other branches
- 5.3 formdefaults.admin.inc \_formdefaults_save_form()
- 6.2 formdefaults.admin.inc \_formdefaults_save_form()
4 calls to _formdefaults_save_form()
File
- ./
formdefaults.admin.inc, line 30 - formdefaults.admin.inc Include for formdefaults administration screen.
Code
function _formdefaults_save_form($formid, $form_array) {
$old_form = formdefaults_getform($formid);
// Change the input format from d6 style to d7 style.
// Keep until D8.
foreach ($form_array as $key => $control) {
if (isset($control['format']) && !isset($control['input_format'])) {
$form_array[$key]['input_format'] = $control['format'];
unset($form_array[$key]['format']);
}
}
$form_data = serialize($form_array);
if ($form_data && $form_array) {
if ($old_form) {
db_update('formdefaults_forms')
->condition('formid', $formid)
->fields(array(
'formdata' => $form_data,
))
->execute();
}
else {
db_insert('formdefaults_forms')
->fields(array(
'formid' => $formid,
'formdata' => $form_data,
))
->execute();
}
}
else {
_formdefaults_delete_form($formid);
}
}