You are here

function biblio_admin_types_add_form_submit in Bibliography Module 6

Same name and namespace in other branches
  1. 6.2 includes/biblio.admin.inc \biblio_admin_types_add_form_submit()
  2. 7 includes/biblio.admin.inc \biblio_admin_types_add_form_submit()
  3. 7.2 includes/biblio.admin.inc \biblio_admin_types_add_form_submit()

File

./biblio.admin.inc, line 1263

Code

function biblio_admin_types_add_form_submit($form, &$form_state) {
  $values = $form_state['values'];
  $values['tid'] = variable_get('biblio_max_user_tid', '999') + 1;
  drupal_write_record('biblio_types', $values);
  variable_set('biblio_max_user_tid', $values['tid']);
  for ($f = 1; $f <= 51; $f++) {
    $ft_vals = array(
      'tid' => $values['tid'],
      'fid' => $f,
      'ftdid' => $f,
      'cust_tdid' => $f,
      'weight' => $f,
      'visible' => 1,
    );
    drupal_write_record('biblio_field_type', $ft_vals);
  }

  // Fill contributor types. Use the first 4 defaults.
  for ($type = 1; $type <= 4; $type++) {
    $ct_vals = array(
      'auth_category' => $type,
      'biblio_type' => $values['tid'],
      'auth_type' => $type,
    );
    drupal_write_record('biblio_contributor_type', $ct_vals);
  }

  // Refresh publication type string for translation.
  biblio_locale_refresh_types($values['tid']);
  drupal_goto('admin/settings/biblio/fields/type');
}