From da5aebe7f03c6f603f89b64dbf18f78a7d0a3db3 Mon Sep 17 00:00:00 2001 From: Adam Vessey Date: Fri, 26 Oct 2012 09:53:29 -0300 Subject: [PATCH] Fix datastream detection for add datastream form. --- includes/datastream.inc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/includes/datastream.inc b/includes/datastream.inc index 3fde916f..69b725ac 100644 --- a/includes/datastream.inc +++ b/includes/datastream.inc @@ -121,7 +121,7 @@ function islandora_get_unused_dsids($object) { } } foreach ($defined_dsids as $key => $value) { - if (isset($fedora_object[$key])) { + if (isset($object[$key])) { unset($defined_dsids[$key]); //ds exists in the object so don't show in the dropdown } } @@ -324,6 +324,9 @@ function islandora_add_datastream_form_validate($form, &$form_state) { * a form ready to be rendered with a call to Drupal render */ function islandora_add_datastream_form($form, &$form_state, $object) { + // Ensure we're loaded, in case AJAX stuff is ever added. + form_load_include($form_state, 'inc', 'islandora', 'includes/datastream'); + $unused_dsids = islandora_get_unused_dsids($object); //$defined_dsids; $form = array(); $form['add_fieldset'] = array( @@ -376,7 +379,7 @@ function islandora_add_datastream_form($form, &$form_state, $object) { $form['add_fieldset']['stream_id'] = array( '#title' => 'Datastream ID', '#required' => 'TRUE', - '#description' => t('An ID for this stream that is unique to this object. Must start with a letter and contain only alphanumeric characters and dashes and underscores. Datastreams that are defined by the content model dont currently exist: ' . $dsids_for_form . '.'), + '#description' => t('An ID for this stream that is unique to this object. Must start with a letter and contain only alphanumeric characters and dashes and underscores. Datastreams that are defined by the content model don\'t currently exist: ' . $dsids_for_form . '.'), '#type' => 'textfield', '#weight' => -1, '#autocomplete_path' => "islandora/object/$object->id/manage/datastreams/add/autocomplete", @@ -476,4 +479,4 @@ function islandora_edit_datastream_registry_render($edit_registry) { $output['#markup'] .= l($edit_route['name'], $edit_route['url']) . '
'; } return $output; -} \ No newline at end of file +}