Browse Source

ISLANDORA-743 Hook firing without session variable.

pull/164/head
William Panting 12 years ago
parent
commit
9c035ad593
  1. 24
      fedora_repository.module
  2. 22
      fedora_repository.solutionpacks.inc

24
fedora_repository.module

@ -2217,7 +2217,9 @@ function _is_added_to_basket($pid, $account = NULL) {
/**
* fedora repository display schema
*
* @param type $file
*
* @return type
*/
function fedora_repository_display_schema($file) {
@ -2236,14 +2238,20 @@ function fedora_repository_display_schema($file) {
*
* @param array $object
* An array defining an object to ingest.
* @param type $context
* @return type
* @param string $module_name
* The string needed in the finished callback to be
* sent out in the postprocess hook.
* @param array $context
* Variables shared between batch iterations
* and finished callback
*/
function fedora_repository_batch_reingest_object($object, &$context) {
function fedora_repository_batch_reingest_object($object, $module_name, &$context) {
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
module_load_include('inc', 'fedora_repository', 'api/fedora_utils');
$context['results']['module_name'] = $module_name;
if (!empty($object) && is_array($object)) {
$pid = $object['pid'];
if (!valid_pid($pid)) {
@ -2317,7 +2325,7 @@ function fedora_repository_solutionpack_send_postprocess($success, $results, $op
// Hook to let solution pack objects be modified.
// Not using module_invoke so solution packs can be expanded by other modules.
if ($success) {
module_invoke_all('postprocess_solution_pack', $_SESSION['solution_pack_module_name']);
module_invoke_all('postprocess_solution_pack', $results['module_name']);
}
}
@ -2350,7 +2358,9 @@ function fedora_repository_get_islandora_datastream_version($item = NULL, $dsid
/**
* theme fedora repository solution pack list
*
* @param type $solution_packs
*
* @return string
*/
function theme_fedora_repository_solution_packs_list($solution_packs) {
@ -2365,8 +2375,10 @@ function theme_fedora_repository_solution_packs_list($solution_packs) {
}
/**
* Implementation of hook_forms()
* Implements hook_forms()
*
* @param string $form_id
*
* @return array
*/
function fedora_repository_forms($form_id) {
@ -2380,7 +2392,7 @@ function fedora_repository_forms($form_id) {
}
/**
* Implementation of hook_imagecache_default_presets().
* Implements hook_imagecache_default_presets().
*/
function fedora_repository_imagecache_default_presets() {
return array(

22
fedora_repository.solutionpacks.inc

@ -58,8 +58,10 @@ function fedora_repository_solution_packs_page() {
* some objects are missing.
*
* @param array &$form_state
* @param array $solution_pack_module
* @param array $solution_pack_name
* @param unknown $solution_pack_module
* @param string $solution_pack_name
* @param array $objects
* Defaults to an empty array.
*/
function fedora_repository_solution_pack_form(&$form_state, $solution_pack_module, $solution_pack_name, $objects = array()) {
@ -200,12 +202,10 @@ function fedora_repository_solution_pack_form_submit($form, &$form_state) {
foreach ($solution_pack_info[$module_name]['objects'] as $object) {
// Add this object to the batch job queue.
$batch['operations'][] = array('fedora_repository_batch_reingest_object', array($object));
// Module name is needed in the finished callback.
$batch['operations'][] = array('fedora_repository_batch_reingest_object', array($object, $module_name));
}
// Used in postprocess hook.
$_SESSION['solution_pack_module_name'] = $module_name;
// Tell the batch to call the function to send out a postprocess hook.
$batch['finished'] = 'fedora_repository_solutionpack_send_postprocess';
@ -216,8 +216,10 @@ function fedora_repository_solution_pack_form_submit($form, &$form_state) {
/**
* Writes a form entry into the database.
*
* @param unknown_type $form_name
* @param string $form_name
* The name of the form.
* @param unknown_type $form_xml
* The form definition.
*/
function solution_pack_add_form($form_name, $form_xml) {
$result = db_result(db_query('Select name from {xml_forms} where name = "%s"', $form_name));
@ -233,8 +235,10 @@ function solution_pack_add_form($form_name, $form_xml) {
/**
* Writes a form association to the database
*
* @param unknown_type $content_model
* @param unknown_type $form_name
* @param string $content_model
* content model PID
* @param string $form_name
* Name of the form
*/
function solution_pack_add_form_association($content_model, $form_name) {
$result = db_result(db_query('Select content_model from {islandora_content_model_forms} where content_model = "%s" and form_name = "%s"',

Loading…
Cancel
Save