You are here

function fontyourface_admin_add_form_submit in @font-your-face 6

Add form submit handler.

File

./fontyourface.module, line 427

Code

function fontyourface_admin_add_form_submit($form, &$form_state) {
  variable_set('fontyourface_sample_text', $form['sample_text']['#value']);
  if ($form['#post']['op'] == t('Add font')) {
    $font = new stdClass();
    $font->provider = $form['module']['#value'];
    $font->group_name = $form['group']['#value'];
    $font->name = $form['font']['#value'];
    $font->css = $form['css']['#value'];
    drupal_write_record('fontyourface', $font);
    $enabled = TRUE;
    $enable_function = $font->provider . '_fontyourface_enable';
    if (function_exists($enable_function)) {
      $enabled = $enable_function($font);
    }

    // if
  }

  // if
  if ($enabled) {
    drupal_set_message(t('Added font') . ' <i>' . $font->name . '</i>.');
  }

  // if
  drupal_goto('admin/build/themes/fontyourface');
}