function exif_custom_map_edit_submit in EXIF Custom 7
Submission callback for exif_custom_map_edit_form().
1 string reference to 'exif_custom_map_edit_submit'
- exif_custom_map_edit_form in ./
exif_custom.edit.inc - Form API callback to edit a mapping.
File
- ./
exif_custom.edit.inc, line 80
Code
function exif_custom_map_edit_submit($form, $form_state) {
$mid = arg(5);
$test = (string) $form_state['values']['delete']['delete'];
if ($test == 'delete') {
db_query('DELETE FROM {exif_custom_mapped_fields} WHERE mid = :mid', array(
':mid' => $mid,
));
db_query('DELETE FROM {exif_custom_maps} WHERE mid = :mid', array(
':mid' => $mid,
));
db_query('DELETE FROM {exif_custom_users} WHERE mid = :mid', array(
':mid' => $mid,
));
drupal_set_message(t('The mapping has been deleted.'));
drupal_goto('admin/config/media/exif_custom');
return;
}
foreach ($form_state['values'] as $field => $value) {
if (substr($field, 0, 10) != 'img_field:') {
break;
}
$field = substr($field, 10);
db_query("UPDATE {exif_custom_mapped_fields}\n SET img_field = :img_field\n WHERE mid = :mid AND exif_field = :exif_field", array(
':img_field' => $value,
':mid' => $mid,
':exif_field' => $field,
));
}
drupal_set_message(t('The mapping has been updated.'));
// Redirect to the mappings list page.
drupal_goto('admin/config/media/exif_custom');
}