You are here

function fonts_com_setup_form_submit in @font-your-face 7.2

Handles account settings form submit.

File

modules/fonts_com/fonts_com.module, line 414

Code

function fonts_com_setup_form_submit($form, &$form_state) {
  module_load_include('inc', 'fonts_com', 'api');
  if ($form_state['input']['op'] == t('Save')) {
    variable_set('fonts_com_token', $form_state['values']['fonts_com_token']);
    drupal_set_message(t('Fonts.com key saved.'));
  }
  elseif ($form_state['input']['op'] == t('Get Key')) {
    $key = fonts_com_get_key_for_account($form_state['values']['fonts_com_pass_email'], $form_state['values']['fonts_com_pass_pass']);
    if ($key) {
      variable_set('fonts_com_token', $key);
      drupal_set_message(t('Fonts.com key saved.'));
    }

    // if
  }
  elseif ($form_state['input']['op'] == t('Create Account')) {
    $success = fonts_com_create_account($form_state['values']['fonts_com_email'], $form_state['values']['fonts_com_first_name'], $form_state['values']['fonts_com_last_name']);
    if ($success) {
      drupal_set_message(t('You will receive an email with your new password at the email address you entered, @email. Enter that email and password below to get your key.', array(
        '@email' => $form_state['values']['fonts_com_email'],
      )));
    }

    // if
  }

  // elseif
}