From 0044efd7538c82d811e19fc48eeb3435bfdc8fc0 Mon Sep 17 00:00:00 2001 From: dheles Date: Tue, 22 Oct 2019 18:32:04 -0400 Subject: [PATCH] Add optional label text to datastream download links --- islandora.module | 5 ++++- theme/theme.inc | 9 ++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/islandora.module b/islandora.module index 3e53ebac..281cde74 100644 --- a/islandora.module +++ b/islandora.module @@ -537,7 +537,10 @@ function islandora_theme() { ), 'islandora_datastream_download_link' => array( 'file' => 'theme/theme.inc', - 'variables' => array('datastream' => NULL), + 'variables' => array( + 'datastream' => NULL, + 'label' => NULL, + ), ), 'islandora_datastream_version_link' => array( 'file' => 'theme/theme.inc', diff --git a/theme/theme.inc b/theme/theme.inc index ef836422..d4ad3a85 100644 --- a/theme/theme.inc +++ b/theme/theme.inc @@ -404,6 +404,7 @@ function template_process_islandora_objects_subset(&$variables) { * @param array $vars * An array containing: * - datastream: An AbstractDatastream for which to generate a download link. + * - label: (Optional) The label for the link. * * @return string * Markup containing the download url if the user has access, empty otherwise. @@ -412,7 +413,13 @@ function theme_islandora_datastream_download_link(array $vars) { $datastream = $vars['datastream']; module_load_include('inc', 'islandora', 'includes/datastream'); - $label = t('download'); + if ($vars['label'] === NULL) { + $label = t('download'); + } + else { + $label = check_plain($vars['label']); + } + return islandora_datastream_access(ISLANDORA_VIEW_OBJECTS, $datastream) ? l($label, islandora_datastream_get_url($datastream, 'download')) : '';