You are here

function biblio_page_view in Bibliography Module 7.2

Displays a biblio; Hands data off to the Field API

Parameters

type $biblio:

type $view_mode View mode defined in biblio_entity_info().:

Return value

type

1 string reference to 'biblio_page_view'
biblio_menu in ./biblio.module
Implements hook_menu().

File

./biblio.module, line 3143

Code

function biblio_page_view($biblio, $view_mode = 'full', $langcode = NULL) {
  if (!isset($langcode)) {
    $langcode = $GLOBALS['language_content']->language;
  }
  global $user;
  $wrapper = biblio_wrapper($biblio);
  $title = $wrapper->biblio_title
    ->value();
  $links = array();
  $style = biblio_get_style();
  $base = variable_get('biblio_base', 'biblio');
  $base_title = check_plain(variable_get('biblio_base_title', 'Biblio'));

  // Remove previously built content, if exists.
  $biblio->content = array();
  switch ($view_mode) {
    case 'full':
      if (variable_get('biblio_hide_bibtex_braces', 0) && !isset($biblio->view)) {
        $title = biblio_remove_brace($title);
      }
      $title = filter_xss($title, biblio_get_allowed_tags());

    // fall through...
    case 'search_index':
      switch (variable_get('biblio_layout', 'standard')) {
        case 'standard':
          field_attach_prepare_view('biblio', array(
            $biblio->bid => $biblio,
          ), $view_mode);
          entity_prepare_view('biblio', array(
            $biblio->bid => $biblio,
          ));
          $biblio->content = field_attach_view('biblio', $biblio, $view_mode);
          if (isset($biblio->content['biblio_keywords'])) {
            $keys = element_children($biblio->content['biblio_keywords']);
            foreach ($keys as $key) {
              $biblio->content['biblio_keywords'][$key]['#href'] = 'biblio/keywords/' . $biblio->content['biblio_keywords'][$key]['#options']['entity']->tid;
            }
          }
          $coins = filter_xss($wrapper->biblio_coins
            ->value(), array(
            'span',
          ));
          $biblio->content['biblio_coins'] = array(
            '#markup' => $coins,
          );
          break;
        case 'orig':
        case 'ft':
          $biblio->content['body']['#markup'] = theme('biblio_long', array(
            'biblio' => $biblio,
            'base' => $base,
            'style' => $style,
          ));
          break;
        case 'tabular':
        default:
          $biblio->content['body']['#markup'] = theme('biblio_tabular', array(
            'biblio' => $biblio,
            'base' => $base,
          ));
          break;
      }
      break;
    case 'teaser':
      $biblio->content['teaser']['#markup'] = theme('biblio_style', array(
        'biblio' => $biblio,
        'base' => $base,
        'style_name' => $style,
      ));
      break;
  }
  drupal_set_title($title);
  module_invoke_all('entity_view', $biblio, 'biblio', $view_mode, $langcode);
  return $biblio->content;
}