Browse Source

Add alter during Tuque connection construction.

pull/643/head
Adam Vessey 9 years ago
parent
commit
b073e26cd1
  1. 16
      includes/tuque_wrapper.inc
  2. 13
      islandora.api.php

16
includes/tuque_wrapper.inc

@ -322,7 +322,21 @@ class IslandoraFedoraObject extends FedoraObject {
} }
} }
class IslandoraRepositoryConnection extends RepositoryConnection {} class IslandoraRepositoryConnection extends RepositoryConnection {
/**
* Constructor.
*
* Invokes parent, but additionally invokes an alter to allow modules to
* effect the configuration of the connection.
*/
public function __construct($url = NULL, $username = NULL, $password = NULL) {
if ($url === NULL) {
$url = static::FEDORA_URL;
}
parent::__construct($url, $username, $password);
drupal_alter('islandora_repository_connection_construction', $this);
}
}
class IslandoraFedoraApi extends FedoraApi { class IslandoraFedoraApi extends FedoraApi {

13
islandora.api.php

@ -873,3 +873,16 @@ function hook_islandora_edit_datastream_registry_alter(&$edit_registry, $context
'url' => "islandora/custom_form/{$context['object']->id}/{$context['datastream']->id}" 'url' => "islandora/custom_form/{$context['object']->id}/{$context['datastream']->id}"
); );
} }
/**
* Permit configuration of connection parameters.
*
* @param IslandoraRepositoryConnection $instance
* The connection being constructed. See the relevant Tuque ancestor classes
* for the particulars.
*
* @see https://github.com/Islandora/tuque/blob/1.x/HttpConnection.php
*/
function hook_islandora_repository_connection_construction_alter($instance) {
$instance->userAgent = "Tuque/cURL";
}

Loading…
Cancel
Save