You are here

function biblio_bibtex_import in Bibliography Module 6

Import bibtex data.

Parameters

$data: the contents of a bibtex file passed as one big string

$node: an array (populated in biblio_import() ), containing the boiler plate information common to all nodes

Return value

an array of node ids

2 calls to biblio_bibtex_import()
biblio_form_validate in ./biblio.module
Implementation of hook_validate().
biblio_import in ./biblio.import.export.inc
Import data from a file and return the node ids created.

File

./biblio.import.export.inc, line 616
Functions that are used to import and export biblio data.

Code

function biblio_bibtex_import($file, $terms = array(), $batch = FALSE, $session_id = NULL, $save = TRUE, $string = FALSE) {
  $nids = array();
  module_load_include('php', 'biblio', 'bibtexParse/PARSEENTRIES');
  $bibtex = new PARSEENTRIES();
  if ($string) {
    $bibtex
      ->loadBibtexString($file);
  }
  else {
    $bibtex
      ->openBib($file->filepath);
  }
  $bibtex
    ->extractEntries();
  if ($bibtex->count) {
    $nids = $bibtex
      ->bib2node($terms, $batch, $session_id, $save);
  }
  return $nids;
}