You are here

function biblio_page_content in Bibliography Module 7

Same name and namespace in other branches
  1. 7.2 includes/biblio.pages.inc \biblio_page_content()
2 calls to biblio_page_content()
biblio_page in includes/biblio.pages.inc
biblio_profile_page in includes/biblio.pages.inc

File

includes/biblio.pages.inc, line 203
Copyright (C) 2006-2011 Ron Jerome.

Code

function biblio_page_content($nids = array(), $extras = array()) {
  $base = variable_get('biblio_base', 'biblio');
  $content = $raw_nodes = $nodes = array();
  $count = $section_id = 0;
  if (module_exists('popups')) {
    popups_add_popups();
  }
  if (count($nids)) {

    // $nids = array_unique($nids);
    $raw_nodes = node_load_multiple($nids);
    $langcode = $GLOBALS['language_content']->language;
    field_attach_prepare_view('node', $raw_nodes, 'biblio_list', $langcode);
    entity_prepare_view('node', $raw_nodes, $langcode);
    foreach ($nids as $key => $nid) {
      if (!empty($extras)) {
        $nodes[] = (object) array_merge((array) $raw_nodes[$nid], (array) $extras[$key]);
      }
      else {
        $nodes[] = $raw_nodes[$nid];
      }
    }
  }
  foreach ($nodes as $node) {
    $count++;
    if (is_array($node)) {
      $node = (object) $node;
    }
    if (variable_get('biblio_hide_bibtex_braces', 0)) {
      $node->title = biblio_remove_brace($node->title);
    }

    // Output new section if needed.
    if ($section = biblio_category_section($node)) {
      $section_id++;
      $content['section_' . $section_id] = $section;
    }
    $content['section_' . $section_id][] = biblio_entry($node);
  }
  $content['pager']['#markup'] = theme('pager');
  if ($count == 0) {
    $content['section_0']['#markup'] = "<h3>" . t("No items found") . "</h3>";
  }
  return $content;
}