function theme_biblio_tabular in Bibliography Module 7
Same name and namespace in other branches
- 6.2 includes/biblio_theme.inc \theme_biblio_tabular()
- 6 biblio_theme.inc \theme_biblio_tabular()
- 7.2 includes/biblio.theme.inc \theme_biblio_tabular()
Parameters
$node:
$base:
$teaser:
1 theme call to theme_biblio_tabular()
- biblio_view in ./
biblio.module - Implements hook_view().
File
- includes/
biblio_theme.inc, line 220
Code
function theme_biblio_tabular($variables) {
module_load_include('inc', 'biblio', '/includes/biblio.contributors');
$node = $variables['node'];
$base = $variables['base'];
static $citeproc;
$node->biblio_type = isset($node->biblio_type) ? $node->biblio_type : NULL;
$node->biblio_type_name = isset($node->biblio_type_name) ? $node->biblio_type_name : NULL;
if (module_exists('popups')) {
popups_add_popups();
}
$tid = $node->biblio_type;
$fields = _biblio_get_field_information($node->biblio_type, TRUE);
$rows[] = array(
array(
'data' => t('Title'),
'class' => array(
'biblio-row-title',
),
),
array(
'data' => filter_xss($node->title, biblio_get_allowed_tags()),
),
);
// Needed for preview.
if (!isset($node->biblio_type_name) && isset($node->biblio_type)) {
if ($pub_type = db_query('SELECT t.tid, t.name FROM {biblio_types} as t WHERE t.tid=:tid', array(
':tid' => $node->biblio_type,
))
->fetchObject()) {
$node->biblio_type_name = drupal_ucfirst(_biblio_localize_type($pub_type->tid, $pub_type->name));
}
}
$rows[] = array(
array(
'data' => t('Publication Type'),
'class' => array(
'biblio-row-title',
),
),
array(
'data' => $node->biblio_type_name,
),
);
$options = variable_get('biblio_links_target_new_window') ? array(
'attributes' => array(
'target' => '_blank',
),
) : array();
$doi = '';
if (!empty($node->biblio_doi)) {
$doi_url = '';
if (($doi_start = strpos($node->biblio_doi, '10.')) !== FALSE) {
$doi = substr($node->biblio_doi, $doi_start);
$doi_url .= 'http://dx.doi.org/' . $doi;
$doi = l($doi, $doi_url, $options);
}
}
foreach ($fields as $key => $row) {
// Handling the contributor categories like any other field orders them correctly by weight.
if ($row['type'] == 'contrib_widget' && ($authors = biblio_get_contributor_category($node->biblio_contributors, $row['fid']))) {
$data = biblio_format_authors($authors);
}
elseif (empty($node->{$row['name']}) || $row['name'] == 'biblio_coins') {
continue;
}
else {
switch ($row['name']) {
case 'biblio_keywords':
$data = _biblio_keyword_links($node->{$row['name']}, $base);
break;
case 'biblio_url':
$data = l($node->{$row['name']}, $node->{$row['name']}, $options);
break;
case 'biblio_doi':
$data = $doi;
break;
default:
if ($row['type'] == 'text_format') {
$format = filter_default_format();
if (!empty($node->biblio_formats)) {
$formats = $node->biblio_formats;
$format = isset($formats[$row['name']]) ? $formats[$row['name']] : $format;
}
$data = check_markup($node->{$row['name']}, $format);
}
else {
$data = check_plain($node->{$row['name']});
}
}
}
$rows[] = array(
array(
'data' => t($row['title']),
'class' => array(
'biblio-row-title',
),
),
array(
'data' => $data,
),
);
}
if (isset($node->body) && !empty($node->body) && user_access('view full text')) {
// Store this in a temp variable to avoid a pass-by-reference error.
$full_text = field_view_field('node', $node, 'body', array(
'label' => 'hidden',
));
$rows[] = array(
array(
'data' => t('Full Text'),
'valign' => 'top',
),
array(
'data' => drupal_render($full_text),
),
);
}
// Let other modules add rows if desired...
drupal_alter('biblio_node_table_rows', $rows, $node);
$node->biblio_coins = isset($node->biblio_coins) ? $node->biblio_coins : biblio_coins($node);
$output = '<div id="biblio-node">';
$output .= filter_xss($node->biblio_coins, array(
'span',
));
$header = array();
$output .= theme('table', array(
'header' => $header,
'rows' => $rows,
));
$output .= '</div>';
return $output;
}