function formdefaults_edit_field_submit in Form Defaults 6.2
Same name and namespace in other branches
- 5.3 formdefaults.admin.inc \formdefaults_edit_field_submit()
- 7 formdefaults.admin.inc \formdefaults_edit_field_submit()
File
- ./
formdefaults.admin.inc, line 462
Code
function formdefaults_edit_field_submit($formid, &$form_state) {
$form_values = $form_state['values'];
$formid = $form_values['formid'];
$fieldname = $form_values['fieldname'];
$formarray = formdefaults_getform($formid);
$baseform = $formarray;
// set the form values
if ($_POST['op'] == 'Reset') {
unset($formarray[$fieldname]);
}
else {
if ($form_values['type'] == 'markup') {
$formarray[$fieldname]['value'] = $form_values['value'];
$formarray[$fieldname]['format'] = $form_values['format'];
}
else {
$formarray[$fieldname]['title'] = $form_values['title'];
$formarray[$fieldname]['description'] = $form_values['description'];
}
if ($form_values['collapsible'] === '') {
unset($formarray[$fieldname]['collapsible']);
}
else {
$formarray[$fieldname]['collapsible'] = $form_values['collapsible'];
}
if ($form_values['collapsed'] === '') {
unset($formarray[$fieldname]['collapsed']);
}
else {
$formarray[$fieldname]['collapsed'] = $form_values['collapsed'];
}
$formarray[$fieldname]['hide_it'] = $form_values['hide_it'];
$formarray[$fieldname]['weight'] = $form_values['weight'];
$formarray[$fieldname]['type'] = $form_values['type'];
}
_formdefaults_save_form($formid, $formarray);
$form_state['redirect'] = 'formdefaults/' . $formid;
}