function theme_biblio_download_links in Bibliography Module 7.2
Same name and namespace in other branches
- 6.2 includes/biblio_theme.inc \theme_biblio_download_links()
- 6 biblio_theme.inc \theme_biblio_download_links()
- 7 includes/biblio_theme.inc \theme_biblio_download_links()
4 theme calls to theme_biblio_download_links()
- biblio_entry in includes/
biblio.pages.inc - biblio_handler_citation::render in views/
biblio_handler_citation.inc - Render the field.
- biblio_plugin_row_citation::render in views/
biblio_plugin_row_citation.inc - Render a row object. This usually passes through to a theme template of some form, but not always.
- theme_biblio_entry in includes/
biblio.theme.inc
File
- includes/
biblio.theme.inc, line 879
Code
function theme_biblio_download_links($variables) {
static $langcode = NULL;
$file_links = array();
$biblio = $variables['biblio'];
if (!isset($langcode)) {
$langcode = $GLOBALS['language_content']->language;
}
$fields = field_attach_view('biblio', $biblio, 'full', $langcode);
foreach (element_children($fields) as $field) {
if ($fields[$field]['#access'] && $fields[$field]['#field_type'] == 'file') {
foreach ($fields[$field]['#items'] as $delta => $item) {
if (module_exists('filefield_paths')) {
$alias = drupal_get_path_alias('filefield_paths/alias/' . $item['fid']);
}
$file_links[] = array(
theme('file_link', array(
'file' => (object) $item,
)),
format_size($item['filesize']),
);
}
}
}
$files = '';
if (count($file_links) > 0 && (user_access('show download links') || user_access('show own download links'))) {
$files .= '<span class="biblio_file_links">';
// $files .= ' ' . t('Download') . ': ';
$file_count = 0;
foreach ($file_links as $file) {
$files .= $file[0] . ' (' . $file[1] . ')';
}
$files .= '</span>';
}
return $files;
}