Browse Source

Allow for altering of the configuration in submit handlers.

pull/223/head
Adam Vessey 12 years ago
parent
commit
eb1a315af1
  1. 22
      includes/ingest.form.inc

22
includes/ingest.form.inc

@ -88,6 +88,10 @@ function islandora_ingest_form_init_form_state_storage(array &$form_state, array
reset($steps); reset($steps);
$form_state['islandora']['step_id'] = key($steps); $form_state['islandora']['step_id'] = key($steps);
} }
// Stash the current configuration in the step.
$storage = &islandora_ingest_form_get_step_storage($form_state);
$storage['configuration'] = $form_state['islandora']['configuration'];
} }
/** /**
@ -253,6 +257,7 @@ function islandora_ingest_form_next_button(array $step_info) {
* The drupal form state. * The drupal form state.
*/ */
function islandora_ingest_form_next_submit(array $form, array &$form_state) { function islandora_ingest_form_next_submit(array $form, array &$form_state) {
dsm($form_state, 'next form_state');
$step = islandora_ingest_form_get_step_number($form_state); $step = islandora_ingest_form_get_step_number($form_state);
drupal_static_reset('islandora_ingest_form_get_steps'); drupal_static_reset('islandora_ingest_form_get_steps');
islandora_ingest_form_stash_info($form_state); islandora_ingest_form_stash_info($form_state);
@ -268,7 +273,8 @@ function islandora_ingest_form_next_submit(array $form, array &$form_state) {
function islandora_ingest_form_stash_info(array &$form_state) { function islandora_ingest_form_stash_info(array &$form_state) {
$storage = &islandora_ingest_form_get_step_storage($form_state); $storage = &islandora_ingest_form_get_step_storage($form_state);
$storage['values'] = $form_state['values']; $storage['values'] = $form_state['values'];
$storage['configuration'] = $form_state['islandora']['configuration']; // XXX: Configuration is handled elsewhere.
//$storage['configuration'] = $form_state['islandora']['configuration'];
unset($form_state['values']); unset($form_state['values']);
} }
@ -278,12 +284,9 @@ function islandora_ingest_form_stash_info(array &$form_state) {
function islandora_ingest_form_grab_info(array &$form_state) { function islandora_ingest_form_grab_info(array &$form_state) {
$storage = islandora_ingest_form_get_step_storage($form_state); $storage = islandora_ingest_form_get_step_storage($form_state);
$form_state['values'] = isset($storage['values'])?$storage['values']:array(); $form_state['values'] = isset($storage['values'])?$storage['values']:array();
$form_state['islandora']['configuration'] = array_merge( if (isset($storage['configuration'])) {
$form_state['islandora']['configuration'], $form_state['islandora']['configuration'] = $storage['configuration'];
isset($storage['configuration'])? }
$storage['configuration']:
array()
);
} }
/** /**
@ -341,7 +344,7 @@ function islandora_ingest_form_submit(array $form, array &$form_state) {
* @return array * @return array
* The configuration used to generate the multi-page ingest forms. * The configuration used to generate the multi-page ingest forms.
*/ */
function &islandora_ingest_form_get_configuration(array $form_state) { function &islandora_ingest_form_get_configuration(array &$form_state) {
return $form_state['islandora']['configuration']; return $form_state['islandora']['configuration'];
} }
@ -515,7 +518,8 @@ function &islandora_ingest_get_steps(array &$form_state) {
// Need to pass by ref... But don't really want an alter. // Need to pass by ref... But don't really want an alter.
foreach (module_implements($hook) as $module) { foreach (module_implements($hook) as $module) {
$function = $module . '_' . $hook; $function = $module . '_' . $hook;
$steps = array_merge($steps, (array)$function($form_state)); $module_steps = (array)$function($form_state);
$steps = array_merge($steps, $module_steps);
} }
} }

Loading…
Cancel
Save