From 01aca9ec24a9b624e9851e40663de591dc2b700b Mon Sep 17 00:00:00 2001 From: Alan Stanley Date: Thu, 10 Oct 2013 10:34:34 -0300 Subject: [PATCH 1/4] added ability to specify file for ingest callbacks --- includes/ingest.form.inc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/includes/ingest.form.inc b/includes/ingest.form.inc index 7edd0f60..8a1ed273 100644 --- a/includes/ingest.form.inc +++ b/includes/ingest.form.inc @@ -422,6 +422,9 @@ function islandora_ingest_form_execute_consecutive_callback_steps(array $form, a function islandora_ingest_form_execute_callback_step(array $form, array &$form_state, array $step) { $args = array(&$form_state); $args = isset($step['do_function']['args']) ? array_merge($args, $step['do_function']['args']) : $args; + if (isset($step['do_function']['file'])) { + require_once DRUPAL_ROOT . '/' . drupal_get_path('module', $step['module']) . "/" . $step['do_function']['file']; + } call_user_func_array($step['do_function']['function'], $args); } @@ -460,6 +463,9 @@ function islandora_ingest_form_undo_consecutive_callback_steps(array $form, arra function islandora_ingest_form_undo_callback_step(array $form, array &$form_state, array $step) { $args = array(&$form_state); $args = isset($step['undo_function']['args']) ? array_merge($args, $step['undo_function']['args']) : $args; + if (isset($step['undo_function']['file'])) { + require_once DRUPAL_ROOT . '/' . drupal_get_path('module', $step['module']) . "/" . $step['undo_function']['file']; + } call_user_func_array($step['undo_function']['function'], $args); } From 3a57a2ce022a57970d519031c2b6d184e7587b68 Mon Sep 17 00:00:00 2001 From: Alan Stanley Date: Thu, 10 Oct 2013 10:39:24 -0300 Subject: [PATCH 2/4] added ability to specify file for ingest callbacks --- islandora.api.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/islandora.api.php b/islandora.api.php index 24d24528..04d8bd49 100644 --- a/islandora.api.php +++ b/islandora.api.php @@ -427,17 +427,21 @@ function hook_islandora_undeletable_datastreams(array $models) { * - do_function: An associate array including: * - 'function': The callback function to be called. * - 'args': An array of arguments to pass to the callback function. + * - 'file': A file to include (relative to the module's path, including + * the file's extension). * - undo_function: An associate array including: * - 'function': The callback function to be called to reverse the * executed action in the ingest steps. * - 'args': An array of arguments to pass to the callback function. + * - 'file': A file to include (relative to the module's path, including + * the file's extension). * Shared parameters between both types: * - weight: The "weight" of this step--heavier(/"larger") values sink to the * end of the process while smaller(/"lighter") values are executed first. * Both types may optionally include: * - module: A module from which we want to load an include. * "Form" type may optionally include: - * - file: A file to include (relative to the module's path, including the + * - 'file': A file to include (relative to the module's path, including the * file's extension). */ function hook_islandora_ingest_steps(array $form_state) { From 51de8b1cabf9fd1923f0c6d5a3ec80ccce0929f1 Mon Sep 17 00:00:00 2001 From: Alan Stanley Date: Thu, 10 Oct 2013 11:02:43 -0300 Subject: [PATCH 3/4] removed reference to DRUPAL_ROOT --- includes/ingest.form.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/ingest.form.inc b/includes/ingest.form.inc index 1bffcfe1..a01e8084 100644 --- a/includes/ingest.form.inc +++ b/includes/ingest.form.inc @@ -423,7 +423,7 @@ function islandora_ingest_form_execute_callback_step(array $form, array &$form_s $args = array(&$form_state); $args = isset($step['do_function']['args']) ? array_merge($args, $step['do_function']['args']) : $args; if (isset($step['do_function']['file'])) { - require_once DRUPAL_ROOT . '/' . drupal_get_path('module', $step['module']) . "/" . $step['do_function']['file']; + require_once drupal_get_path('module', $step['module']) . "/" . $step['do_function']['file']; } call_user_func_array($step['do_function']['function'], $args); } @@ -464,7 +464,7 @@ function islandora_ingest_form_undo_callback_step(array $form, array &$form_stat $args = array(&$form_state); $args = isset($step['undo_function']['args']) ? array_merge($args, $step['undo_function']['args']) : $args; if (isset($step['undo_function']['file'])) { - require_once DRUPAL_ROOT . '/' . drupal_get_path('module', $step['module']) . "/" . $step['undo_function']['file']; + require_once drupal_get_path('module', $step['module']) . "/" . $step['undo_function']['file']; } call_user_func_array($step['undo_function']['function'], $args); } From 8bd7f9349de233703b371d42538d0b1c4d579ef5 Mon Sep 17 00:00:00 2001 From: Alan Stanley Date: Thu, 10 Oct 2013 11:06:06 -0300 Subject: [PATCH 4/4] format change --- includes/ingest.form.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/ingest.form.inc b/includes/ingest.form.inc index a01e8084..95944eb1 100644 --- a/includes/ingest.form.inc +++ b/includes/ingest.form.inc @@ -463,7 +463,7 @@ function islandora_ingest_form_undo_consecutive_callback_steps(array $form, arra function islandora_ingest_form_undo_callback_step(array $form, array &$form_state, array $step) { $args = array(&$form_state); $args = isset($step['undo_function']['args']) ? array_merge($args, $step['undo_function']['args']) : $args; - if (isset($step['undo_function']['file'])) { + if (isset($step['undo_function']['file'])) { require_once drupal_get_path('module', $step['module']) . "/" . $step['undo_function']['file']; } call_user_func_array($step['undo_function']['function'], $args);