You are here

function quicktabs_form_submit in Quick Tabs 6.3

Same name and namespace in other branches
  1. 5 quicktabs.module \quicktabs_form_submit()
  2. 6 quicktabs.module \quicktabs_form_submit()
  3. 6.2 includes/admin.inc \quicktabs_form_submit()
  4. 7.3 quicktabs.admin.inc \quicktabs_form_submit()
  5. 7.2 includes/admin.inc \quicktabs_form_submit()

Submit handler for quicktabs admin page.

File

includes/admin.inc, line 535

Code

function quicktabs_form_submit($form, &$form_state) {

  // We don't want it to submit when we're just adding or removing tabs.
  if ($form_state['clicked_button']['#id'] == 'edit-submit-form') {
    $quicktabs = _quicktabs_convert_form_to_quicktabs($form_state);
    drupal_alter('quicktabs', $quicktabs, 'presave');
    $exists = quicktabs_load($quicktabs['machine_name']);
    if ($exists && empty($exists['in_code_only'])) {
      $ret = drupal_write_record('quicktabs', $quicktabs, 'machine_name');
      if ($ret == SAVED_UPDATED) {
        drupal_set_message(t('The quicktab block has been updated.'));
      }
    }
    else {
      $ret = drupal_write_record('quicktabs', $quicktabs);
      if ($ret == SAVED_NEW) {
        drupal_set_message(t('The quicktab block has been created.'));
      }
    }

    // Update the i18nstrings record
    if (module_exists('i18nstrings')) {
      foreach ($quicktabs['tabs'] as $tabkey => $tab) {
        i18nstrings_update('quicktabs:tab:' . $quicktabs['machine_name'] . '--' . $tabkey . ':title', $tab['title']);
      }
    }
    drupal_goto('admin/build/quicktabs');
  }
}