Browse Source

moved url creation out of the viewer callback function, because in the future this could potentially be an array or anything more custom

pull/200/head
DannyJoris 12 years ago
parent
commit
8be95dc65e
  1. 20
      includes/solution_packs.inc

20
includes/solution_packs.inc

@ -641,16 +641,14 @@ function theme_islandora_viewers_table($variables) {
* *
* @TODO add documentation * @TODO add documentation
*/ */
function islandora_get_viewer($object_id = NULL, $dsid = NULL, $settings_id = NULL) { function islandora_get_viewer($url = NULL, $settings_id = NULL) {
// get viewer from settings // get viewer from settings
$settings = variable_get($settings_id, array()); $settings = variable_get($settings_id, array());
// make sure a viewer is set // make sure a viewer is set
if (!empty($settings) AND $settings['default'] !== 'none') { if (!empty($settings) AND $settings['default'] !== 'none') {
// create url
$url = islandora_get_viewer_url($object_id, $dsid);
// get callback function // get callback function
$viewer_id = islandora_get_viewer_id($settings_id); $viewer_id = islandora_get_viewer_id($settings_id);
if ($viewer_id) { if ($viewer_id AND $url !== NULL) {
$callback = islandora_get_viewer_callback($viewer_id); $callback = islandora_get_viewer_callback($viewer_id);
// call callback function // call callback function
return $callback($url); return $callback($url);
@ -659,20 +657,6 @@ function islandora_get_viewer($object_id = NULL, $dsid = NULL, $settings_id = NU
return NULL; return NULL;
} }
/**
* Get the url to be passed to the viewer.
*
* @TODO add documentation
*/
function islandora_get_viewer_url($object_id = NULL, $dsid = NULL) {
global $base_url;
if ($object_id !== NULL AND $dsid !== NULL) {
$url = $base_url . '/islandora/object/' . $object_id . '/datastream/' . $dsid . '/view';
return $url;
}
return FALSE;
}
/** /**
* Get id of the enabled viewer. * Get id of the enabled viewer.
* *

Loading…
Cancel
Save