You are here

function theme_biblio_citeproc_style in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 modules/CiteProc/biblio_citeproc.module \theme_biblio_citeproc_style()
  2. 7.2 modules/CiteProc/biblio_citeproc.module \theme_biblio_citeproc_style()
1 call to theme_biblio_citeproc_style()
biblio_citeproc_example_citation in modules/CiteProc/biblio_citeproc.admin.inc

File

modules/CiteProc/biblio_citeproc.module, line 132

Code

function theme_biblio_citeproc_style($variables) {
  static $citeproc;
  global $language;
  $cached = NULL;
  $node = $variables['node'];
  $style = isset($variables['style_name']) ? $variables['style_name'] : NULL;
  module_load_include('inc', 'biblio_citeproc', 'CSL');
  if (!$citeproc) {
    $csl_id = $style ? $style : biblio_get_style();
    if ($csl_file_contents = biblio_citeproc_load_csl($csl_id)) {

      // $cslid = $csl_file_name . '-' . $language->language;
      //    $cached = cache_get($cslid, 'cache_biblio_csl_object');.
      if (!$cached) {
        $citeproc = new citeproc($csl_file_contents, $language->language);

        // cache_set($cslid, $citeproc, 'cache_biblio_csl_object');.
      }
      else {
        $citeproc = $cached->data;
      }
    }
  }
  $output = '';
  if ($citeproc) {
    $styled_node = $citeproc
      ->render($node);
    $coins_data = isset($node->biblio_coins) ? filter_xss($node->biblio_coins, array(
      'span',
    )) : '';
    $output = $styled_node . $coins_data;
  }
  return $output;
}