You are here

function biblio_get_map in Bibliography Module 7.2

Same name and namespace in other branches
  1. 6.2 biblio.module \biblio_get_map()
  2. 7 biblio.module \biblio_get_map()

Get publication type mapping for a biblio import type

Parameters

string $type (can be one of "type_names", "type_map" or "field_map"):

string $format (tagged, ris, endnote_xml8 etc...):

Return value

array $map

20 calls to biblio_get_map()
BiblioImportExportUnitTest::testBiblioBibtexFileImport in tests/import.export.test
BiblioImportExportUnitTest::testBiblioRISFileImport in tests/import.export.test
BiblioImportExportUnitTest::testBiblioTaggedFileImport in tests/import.export.test
BiblioImportExportUnitTest::testBiblioXMLFileImport in tests/import.export.test
biblio_admin_field_mapper_form in includes/biblio.admin.inc

... See full list

File

./biblio.module, line 2436

Code

function biblio_get_map($type, $format) {
  $result = db_select('biblio_type_maps', 'btm')
    ->fields('btm', array(
    $type,
  ))
    ->condition('format', $format)
    ->execute()
    ->fetchField();
  $map = unserialize($result);
  if ($type == 'export_map' && empty($map)) {
    $schema = drupal_get_schema('biblio');
    $fieldnames = array_keys($schema['fields']);
    asort($fieldnames);
    $map = array_fill_keys($fieldnames, 1);
  }
  return $map;
}