You are here

function _reset_bibtex_map in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 modules/bibtexParse/biblio_bibtex.install \_reset_bibtex_map()
  2. 7.2 modules/bibtexParse/biblio_bibtex.install \_reset_bibtex_map()
1 call to _reset_bibtex_map()
biblio_bibtex_bibtex_map_reset in modules/bibtexParse/biblio_bibtex.module

File

modules/bibtexParse/biblio_bibtex.install, line 150
Database table creation for biblio_bibtex module.

Code

function _reset_bibtex_map($type) {
  $count = db_query("SELECT COUNT(*)  FROM {biblio_type_maps} WHERE format='bibtex'")
    ->fetchField();

  // Update.
  if ($count && $type) {
    $function = '_get_bibtex_' . $type;
    if (!function_exists($function)) {
      return;
    }
    $map = $function();
    db_update('biblio_type_maps')
      ->fields($map)
      ->condition('format', 'bibtex')
      ->execute();
  }
  else {
    db_delete('biblio_type_maps')
      ->condition('format', 'bibtex')
      ->execute();
    _save_bibtex_maps();
  }
}