You are here

function _reset_csl_map in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 modules/CiteProc/biblio_citeproc.install \_reset_csl_map()
  2. 7.2 modules/CiteProc/biblio_citeproc.install \_reset_csl_map()
2 calls to _reset_csl_map()
biblio_citeproc_csl_map_reset in modules/CiteProc/biblio_citeproc.module
biblio_citeproc_update_7001 in modules/CiteProc/biblio_citeproc.install
Adds CSL field and type maps to biblio_type_maps table.

File

modules/CiteProc/biblio_citeproc.install, line 325

Code

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

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