Browse Source

Updated label retrieval method.

pull/656/head^2
MorganDawe 9 years ago
parent
commit
513eb2d2b4
  1. 12
      includes/ingest.form.inc

12
includes/ingest.form.inc

@ -495,14 +495,14 @@ function islandora_ingest_form_stepify(array $form, array &$form_state, array $s
*/ */
function islandora_ingest_form_add_step_context(array &$form, array $form_state) { function islandora_ingest_form_add_step_context(array &$form, array $form_state) {
$items = array(); $items = array();
$get_label = function(AbstractObject $object) { $get_label = function(AbstractObject $object, AbstractObject $fedora_cmodel) {
if (isset($object['COLLECTION_POLICY'])) { if (isset($object['COLLECTION_POLICY'])) {
$policy = new CollectionPolicy($object['COLLECTION_POLICY']->content); $policy = new CollectionPolicy($object['COLLECTION_POLICY']->content);
$policy_content_models = $policy->getContentModels(); $policy_content_models = $policy->getContentModels();
} }
return isset($policy_content_models[$object->id]) ? return isset($policy_content_models[$fedora_cmodel->id]) ?
$policy_content_models[$object->id]['name'] : $policy_content_models[$fedora_cmodel->id]['name'] :
$object->label; $fedora_cmodel->label;
}; };
$shared_storage = islandora_ingest_form_get_shared_storage($form_state); $shared_storage = islandora_ingest_form_get_shared_storage($form_state);
foreach ($shared_storage['models'] as $key => $value) { foreach ($shared_storage['models'] as $key => $value) {
@ -511,11 +511,11 @@ function islandora_ingest_form_add_step_context(array &$form, array $form_state)
if (is_array($shared_storage['collection'])) { if (is_array($shared_storage['collection'])) {
// Form state config allows for multiple collection objects. // Form state config allows for multiple collection objects.
foreach ($shared_storage['collection'] as $collection) { foreach ($shared_storage['collection'] as $collection) {
$items[$value] = $get_label($collection); $items[$value] = $get_label($collection, $fedora_cmodel);
} }
} }
else { else {
$items[$value] = $get_label($shared_storage['collection']); $items[$value] = $get_label($shared_storage['collection'], $fedora_cmodel);
} }
} }
} }

Loading…
Cancel
Save