function theme_biblio_tabular in Bibliography Module 7.2
Same name and namespace in other branches
- 6.2 includes/biblio_theme.inc \theme_biblio_tabular()
- 6 biblio_theme.inc \theme_biblio_tabular()
- 7 includes/biblio_theme.inc \theme_biblio_tabular()
Parameters
$node:
$base:
$teaser:
Return value
unknown_type
1 theme call to theme_biblio_tabular()
- biblio_page_view in ./
biblio.module - Displays a biblio; Hands data off to the Field API
File
- includes/
biblio.theme.inc, line 195
Code
function theme_biblio_tabular($variables) {
module_load_include('inc', 'biblio', '/includes/biblio.contributors');
$biblio = $variables['biblio'];
$wrapper = biblio_wrapper($biblio);
$base = $variables['base'];
static $citeproc;
if (module_exists('popups')) {
popups_add_popups();
}
$tid = $biblio->publication_type;
// $fields = _biblio_get_field_information($biblio->publication_type, TRUE);
// $rows[] = array(
// array('data' => t('Title'), 'class' => array('biblio-row-title')),
// array('data' => filter_xss($wrapper->biblio_title->value(), biblio_get_allowed_tags()))
// );
if (!isset($biblio->biblio_type_name) && isset($biblio->publication_type)) {
// needed for preview
$types = biblio_types();
$type_name = $types[$biblio->publication_type]->name;
$biblio->biblio_type_name = drupal_ucfirst(_biblio_localize_type($type_name));
}
$rows[] = array(
array(
'data' => t('Publication Type'),
'class' => array(
'biblio-row-title',
),
),
array(
'data' => $biblio->biblio_type_name,
),
);
$attrib = variable_get('biblio_links_target_new_window', FALSE) ? array(
'target' => '_blank',
) : array();
$doi = $wrapper->biblio_doi
->value();
if (!empty($doi)) {
$doi_url = '';
if (($doi_start = strpos($wrapper->biblio_doi
->value(), '10.')) !== FALSE) {
$doi = substr($wrapper->biblio_doi
->value(), $doi_start);
$doi_url .= 'http://dx.doi.org/' . $doi;
$doi = l($doi, $doi_url, $attrib);
}
}
$biblio_fields['contributors'] = array(
'value' => biblio_format_authors($biblio->biblio_contributors),
'label' => 'Authors',
);
if (isset($biblio->biblio_contributors)) {
foreach ($biblio->biblio_contributors as $cid => $contributor) {
}
}
foreach ($biblio as $field_name => $data) {
if (isset($wrapper->{$field_name})) {
$field_value = $wrapper->{$field_name}
->value();
$field_info = field_info_instance('biblio', $field_name, $biblio->publication_type);
if (isset($field_value) && !empty($field_info)) {
$biblio_fields[$field_name]['value'] = $wrapper->{$field_name}
->value();
$biblio_fields[$field_name]['label'] = $field_info['label'];
}
}
}
foreach ($biblio_fields as $field => $row) {
if (isset($wrapper->{$field})) {
$value = $wrapper->{$field}
->value();
}
// handling the contributor categories like any other field orders them correctly by weight
if ($field == 'contributors') {
$data = $row['value'];
}
elseif (empty($value) || $field == 'biblio_coins') {
continue;
}
else {
switch ($field) {
case 'biblio_keywords':
$data = _biblio_keyword_links($value, $base);
break;
case 'biblio_url':
$data = l($value, $value, $attrib);
break;
case 'biblio_doi':
$data = $doi;
break;
default:
if (isset($row['type']) && $row['type'] == 'text_format') {
$data = check_markup($value, $wrapper->biblio_formats[$field]);
}
else {
$data = is_string($value) ? check_plain($value) : '';
}
}
}
$rows[] = array(
array(
'data' => t($row['label']),
'class' => array(
'biblio-row-title',
),
),
array(
'data' => $data,
),
);
}
// @todo: get rid of body and make a full text field
if (isset($biblio->body) && !empty($biblio->body) && user_access('view full text')) {
$rows[] = array(
array(
'data' => t('Full Text'),
'valign' => 'top',
),
array(
'data' => drupal_render(field_view_field('biblio', $biblio, 'body', array(
'label' => 'hidden',
))),
),
);
}
$output = '<div id="biblio-node">';
$output .= filter_xss($wrapper->biblio_coins
->value(), array(
'span',
));
$header = array();
$output .= theme('table', array(
'header' => $header,
'rows' => $rows,
));
$output .= '</div>';
return $output;
}