From cb3e9b083d50a9cf29dce7ba383c7875d4c8be79 Mon Sep 17 00:00:00 2001 From: Alan Stanley Date: Fri, 12 Apr 2013 09:59:51 -0300 Subject: [PATCH] Converted CM query to sparql to allow for unlabeled Content Models --- includes/utilities.inc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/includes/utilities.inc b/includes/utilities.inc index 7e5a339a..cd2cbd86 100644 --- a/includes/utilities.inc +++ b/includes/utilities.inc @@ -762,8 +762,9 @@ function islandora_content_model_select_table_form_element($drupal_variable) { } } $defaults = array(); - $options = array(); - $options = $options + islandora_get_content_models(TRUE); + $rows = array(); + $content_models = array(); + $options = islandora_get_content_models(TRUE); foreach($options as $option){ $content_models[$option['pid']] = $option['label']; @@ -771,7 +772,9 @@ function islandora_content_model_select_table_form_element($drupal_variable) { $selected = array_values(variable_get($drupal_variable, array(''))); foreach($selected as $selection){ - $content_models = array($selection => $content_models[$selection]) + $content_models; + if(isset($content_models[$selection])){ + $content_models = array($selection => $content_models[$selection]) + $content_models; + } } foreach ($content_models as $pid => $label) { @@ -791,6 +794,7 @@ function islandora_content_model_select_table_form_element($drupal_variable) { '#header' => $header, '#options' => $rows, '#default_value' => $defaults, + '#empty' => t("There are no content models in this Fedora Repository.") ); return $element;