From 6133b0973c082d7a4de1ca65a3b2e4d34cbf7cdb Mon Sep 17 00:00:00 2001 From: Jordan Dukart Date: Wed, 9 Jul 2014 18:45:30 +0000 Subject: [PATCH] Magic to get around a core Drupal problem. --- includes/ingest.form.inc | 6 +++++- islandora.module | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/includes/ingest.form.inc b/includes/ingest.form.inc index f7979063..b5a4740d 100644 --- a/includes/ingest.form.inc +++ b/includes/ingest.form.inc @@ -706,7 +706,11 @@ function islandora_ingest_form_ingest_button(array &$form_state) { $validate_callback = $form_id . '_validate'; $validate = function_exists($validate_callback) ? array($validate_callback) : NULL; $submit_callback = $form_id . '_submit'; - $submit = function_exists($submit_callback) ? array($submit_callback, 'islandora_ingest_form_submit') : array('islandora_ingest_form_submit'); + $submit = function_exists($submit_callback) ? array( + $submit_callback, + 'islandora_ingest_form_pre_submit', + 'islandora_ingest_form_submit', + ) : array('islandora_ingest_form_pre_submit', 'islandora_ingest_form_submit'); return array( '#type' => 'submit', '#name' => 'ingest', diff --git a/islandora.module b/islandora.module index ff077212..2b678b78 100644 --- a/islandora.module +++ b/islandora.module @@ -1913,3 +1913,19 @@ function islandora_find_package($package_name) { } return $found && user_access('administer site configuration'); } + +/** + * Helper function for ingest steps and batches. + * + * When batches within batches are triggered within ingest steps + * the submit handler becomes out of scope. When it becomes time to execute the + * submit the function cannot be found and fails. This pre-submit is to + * get around this problem. + * + * @see https://www.drupal.org/node/2300367 + * + * @see https://www.drupal.org/node/1300928 + */ +function islandora_ingest_form_pre_submit($form, &$form_state) { + module_load_include('inc', 'islandora', 'includes/ingest.form'); +}