Browse Source

Fixes incorrect assumption (#664)

Not all step based ingest workflows required to have a parent
COLLECTION object. Even when it’s common, there are concrete cases,
like newspapers and books, where the parent object is not a collection.
And more over, it does not require such because the resulting ingested
object are not children of such. This pull request fixes an error
introduced by a recent pull which enabled Contextual CMODEL labels on
step forms and broke book and newspaper drupal tests. Also adds the
ability to enable/disable those contextual messages since the use case
could not be global.
pull/666/head
Diego Pino Navarro 8 years ago committed by dannylamb
parent
commit
0bb0444414
  1. 6
      includes/admin.form.inc
  2. 12
      includes/ingest.form.inc
  3. 1
      islandora.install

6
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'),

12
includes/ingest.form.inc

@ -477,9 +477,10 @@ function islandora_ingest_form_stepify(array $form, array &$form_state, array $s
$form['hidden_next']['#suffix'] = '</div>';
}
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) {

1
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');
}

Loading…
Cancel
Save