Browse Source

Moved tuque singleton creation method from within module file to utilities file.

pull/372/head
Christian Selig 13 years ago
parent
commit
7c2627409c
  1. 24
      includes/utilities.inc
  2. 15
      islandora.module

24
includes/utilities.inc

@ -910,3 +910,27 @@ function islandora_as_renderable_array(&$markup_array) {
}
unset($value);
}
/**
* Creates and returns a singleton of tuque if one does not already exist.
*
* @param object $user
* User who created the request.
* @param object $url
* URL to Fedora.
*
* @return IslandoraTuque
* An IslandoraTuque instance.
*/
function islandora_make_tuque($user, $url) {
if (IslandoraTuque::exists()) {
try {
return new IslandoraTuque($user, $url);
}
catch (Exception $e) {
drupal_set_message(t('Unable to connect to the repository %e', array('%e' => $e)), 'error');
}
}
return NULL;
}

15
islandora.module

@ -821,6 +821,8 @@ function islandora_default_islandora_view_object($object) {
* A IslandoraTuque instance
*/
function islandora_get_tuque_connection($new_user = NULL, $url = NULL) {
module_load_include('inc', 'islandora', 'includes/utilities');
$tuque = &drupal_static(__FUNCTION__);
global $user;
@ -894,19 +896,6 @@ function islandora_get_tuque_connection($new_user = NULL, $url = NULL) {
return $tuque;
}
function islandora_make_tuque($user, $url) {
if (IslandoraTuque::exists()) {
try {
return new IslandoraTuque($user, $url);
}
catch (Exception $e) {
drupal_set_message(t('Unable to connect to the repository %e', array('%e' => $e)), 'error');
}
}
return NULL;
}
/**
* Loads the object from the given ID if possible.
*

Loading…
Cancel
Save