Browse Source

Make the "undo_function" bit optional.

The "undo_function" part of callbacks was required, even though it
might not be required for functionality... Make it optional, so we
don't end up making/using no-op functions to avoid doing anything.
pull/473/head
Adam Vessey 11 years ago
parent
commit
785eedcc83
  1. 12
      includes/ingest.form.inc
  2. 6
      islandora.api.php

12
includes/ingest.form.inc

@ -467,12 +467,14 @@ function islandora_ingest_form_undo_consecutive_callback_steps(array $form, arra
* The step which the undo callback is being called on. * The step which the undo callback is being called on.
*/ */
function islandora_ingest_form_undo_callback_step(array $form, array &$form_state, array $step) { function islandora_ingest_form_undo_callback_step(array $form, array &$form_state, array $step) {
$args = array(&$form_state); if (isset($step['undo_function'])) {
$args = isset($step['undo_function']['args']) ? array_merge($args, $step['undo_function']['args']) : $args; $args = array(&$form_state);
if (isset($step['undo_function']['file'])) { $args = isset($step['undo_function']['args']) ? array_merge($args, $step['undo_function']['args']) : $args;
require_once drupal_get_path('module', $step['module']) . "/" . $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);
} }
call_user_func_array($step['undo_function']['function'], $args);
} }
/** /**

6
islandora.api.php

@ -423,13 +423,13 @@ function hook_islandora_undeletable_datastreams(array $models) {
* - form_id: The form building function to call to get the form structure * - form_id: The form building function to call to get the form structure
* for this step. * for this step.
* - args: An array of arguments to pass to the form building function. * - args: An array of arguments to pass to the form building function.
* Required "callback" type specific parameters: * "Callback" type specific parameters:
* - do_function: An associate array including: * - do_function: A required associative array including:
* - 'function': The callback function to be called. * - 'function': The callback function to be called.
* - 'args': An array of arguments to pass to the callback function. * - 'args': An array of arguments to pass to the callback function.
* - 'file': A file to include (relative to the module's path, including * - 'file': A file to include (relative to the module's path, including
* the file's extension). * the file's extension).
* - undo_function: An associate array including: * - undo_function: An optional associative array including:
* - 'function': The callback function to be called to reverse the * - 'function': The callback function to be called to reverse the
* executed action in the ingest steps. * executed action in the ingest steps.
* - 'args': An array of arguments to pass to the callback function. * - 'args': An array of arguments to pass to the callback function.

Loading…
Cancel
Save