diff --git a/includes/admin.form.inc b/includes/admin.form.inc index 3293c343..6736596b 100644 --- a/includes/admin.form.inc +++ b/includes/admin.form.inc @@ -96,6 +96,12 @@ function islandora_repository_admin(array $form, array &$form_state) { useful if derivatives are to be created by an external service.'), '#default_value' => variable_get('islandora_defer_derivatives_on_ingest', FALSE), ), + 'islandora_render_context_ingeststep' => array( + '#type' => 'checkbox', + '#title' => t('Render applicable Content Model label(s) during ingest steps'), + '#description' => t('This enables contextual titles, displaying Content Model label(s), to be added on top of ingest forms.'), + '#default_value' => variable_get('islandora_render_context_ingeststep', FALSE), + ), 'islandora_show_print_option' => array( '#type' => 'checkbox', '#title' => t('Show print option on objects'), diff --git a/includes/ingest.form.inc b/includes/ingest.form.inc index 5e50313a..d4d7e895 100644 --- a/includes/ingest.form.inc +++ b/includes/ingest.form.inc @@ -477,9 +477,10 @@ function islandora_ingest_form_stepify(array $form, array &$form_state, array $s $form['hidden_next']['#suffix'] = ''; } - // Add active CModel header to the form. - islandora_ingest_form_add_step_context($form, $form_state); - + if (variable_get('islandora_render_context_ingeststep', FALSE)) { + // 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; @@ -495,7 +496,7 @@ function islandora_ingest_form_stepify(array $form, array &$form_state, array $s */ function islandora_ingest_form_add_step_context(array &$form, array $form_state) { $items = array(); - $get_label = function(AbstractObject $collection, AbstractObject $fedora_cmodel) { + $get_label = function(AbstractObject $collection = NULL, AbstractObject $fedora_cmodel) { if (isset($collection['COLLECTION_POLICY'])) { $policy = new CollectionPolicy($collection['COLLECTION_POLICY']->content); $policy_content_models = $policy->getContentModels(); @@ -505,6 +506,13 @@ function islandora_ingest_form_add_step_context(array &$form, array $form_state) $fedora_cmodel->label; }; $shared_storage = islandora_ingest_form_get_shared_storage($form_state); + + // Ingest steps also work for newspaper children and + // pages of books which don't pass a collection object + // and of course don't use collection policies. + if (!isset($shared_storage['collection'])) { + $shared_storage['collection'] = NULL; + } foreach ($shared_storage['models'] as $key => $value) { $fedora_cmodel = islandora_object_load($value); if ($fedora_cmodel) { diff --git a/islandora.install b/islandora.install index d993f80c..95cca708 100644 --- a/islandora.install +++ b/islandora.install @@ -59,6 +59,7 @@ function islandora_uninstall() { 'islandora_semaphore_period', 'islandora_require_obj_upload', 'islandora_breadcrumbs_backends', + 'islandora_render_context_ingeststep', ); array_walk($variables, 'variable_del'); }