You are here

function sendgrid_integration_admin_submit in SendGrid Integration 7

Submit handler for admin settings.

We use a custom submit handler to only set variables if values are supplied in the UI.

_state

Parameters

$form:

Return value

bool

1 string reference to 'sendgrid_integration_admin_submit'
sendgrid_integration_admin in ./sendgrid_integration.admin.inc
Provides Settings Form.

File

./sendgrid_integration.admin.inc, line 90

Code

function sendgrid_integration_admin_submit($form, $form_state) {
  if (isset($form_state['values']['sendgrid_integration_maillog_log'])) {
    variable_set('sendgrid_integration_maillog_log', check_plain($form_state['values']['sendgrid_integration_maillog_log']));
  }
  if (isset($form_state['values']['sendgrid_integration_maillog_devel'])) {
    variable_set('sendgrid_integration_maillog_devel', check_plain($form_state['values']['sendgrid_integration_maillog_devel']));
  }
  $existingkey = variable_get('sendgrid_integration_apikey', '');
  if (empty($form_state['values']['sendgrid_integration_apikey']) && !empty($existingkey)) {
    return TRUE;
  }
  if (isset($form_state['values']['sendgrid_integration_apikey']) && !empty($form_state['values']['sendgrid_integration_apikey'])) {
    variable_set('sendgrid_integration_apikey', check_plain($form_state['values']['sendgrid_integration_apikey']));
    drupal_set_message(t('SendGrid Settings Saved'), 'status', FALSE);
    return TRUE;
  }
}