diff --git a/includes/ingest.form.inc b/includes/ingest.form.inc index f3cde3e5..d804f1b4 100644 --- a/includes/ingest.form.inc +++ b/includes/ingest.form.inc @@ -476,11 +476,38 @@ function islandora_ingest_form_stepify(array $form, array &$form_state, array $s $form['hidden_next']['#prefix'] = '
'; $form['hidden_next']['#suffix'] = '
'; } + + // Add active CModel header to the form. + islandora_ingest_form_add_step_context($form, $form_state); + // Allow for a hook_form_FORM_ID_alter(). drupal_alter(array('form_' . $step['form_id'], 'form'), $form, $form_state, $step['form_id']); return $form; } +/** + * Append CModel label to the top of the step's form. + * + * @param array $form + * The Drupal form. + * @param array $form_state + * The Drupal form state. + */ +function islandora_ingest_form_add_step_context(array &$form, array $form_state) { + foreach ($form_state['islandora']['shared_storage']['models'] as $key => $value) { + $fedora_cmodel = islandora_object_load($value); + if ($fedora_cmodel) { + $policy = new CollectionPolicy($form_state['islandora']['shared_storage']['collection']['COLLECTION_POLICY']->content); + $policy_content_models = $policy->getContentModels(); + $label = isset($policy_content_models[$value]) ? $policy_content_models[$value]['name'] : $fedora_cmodel->label; + $form["context_info_$key"] = array( + '#markup' => "

$label


", + '#weight' => -1000, + ); + } + } +} + /** * Checks if we are on the first form step. * @@ -921,22 +948,6 @@ function islandora_ingest_form_get_steps(array &$form_state) { return $steps; } -/** - * Implements hook_form_alter(). - */ -function islandora_form_islandora_ingest_form_alter(&$form, &$form_state) { - foreach ($form_state['islandora']['shared_storage']['models'] as $key => $cmodel) { - $fedora_cmodel = islandora_object_load($cmodel); - if ($fedora_cmodel) { - $form["contact_information_$key"] = array( - '#markup' => "

$fedora_cmodel->label


", - '#weight' => -1000, - ); - } - - } -} - /** * Filter the ingest steps to only steps of type 'form'. *