You are here

function messaging_template_admin_settings_submit in Messaging 6.3

Template settings submission

File

messaging_template/messaging_template.admin.inc, line 119
Messaging Framework - Admin UI

Code

function messaging_template_admin_settings_submit($form, $form_state) {
  $op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';
  switch ($op) {
    case t('Save configuration'):
      foreach ($form_state['values']['templates'] as $type => $values) {
        db_query("UPDATE {messaging_template} SET enabled = %d, fallback = '%s' WHERE type = '%s'", $values['enabled'], $values['fallback'], $type);
      }
      drupal_set_message('Your template options have been updated.');
      break;
    case t('Reset to defaults'):
      db_query('DELETE FROM {messaging_template}');
      drupal_set_message(t('Your template options have been restored to their default values.'));
      break;
  }
}