From 448709c9325b79659aaff862fbfa2dc6f852534a Mon Sep 17 00:00:00 2001 From: ajstanley Date: Fri, 29 Jul 2016 13:10:38 -0300 Subject: [PATCH] allowances made for missing content models --- islandora.module | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/islandora.module b/islandora.module index 809b0d61..82f891ba 100644 --- a/islandora.module +++ b/islandora.module @@ -2175,22 +2175,24 @@ function islandora_islandora_get_breadcrumb_query_predicates(AbstractObject $obj * Implements hook_islandora_overview_object(). */ function islandora_islandora_overview_object(AbstractObject $object) { - if (is_object($object)) { - $cmodels = $object->models; - $rows = array(); - foreach ($cmodels as $cmodel) { - if ($cmodel != 'fedora-system:FedoraObject-3.0') { - $o = islandora_object_load($cmodel); - if(is_object($o)) { - $rows[] = array(l($o->label, "islandora/object/{$o->id}")); - } + + $cmodels = $object->models; + $rows = array(); + foreach ($cmodels as $cmodel) { + if ($cmodel != 'fedora-system:FedoraObject-3.0') { + $o = islandora_object_load($cmodel); + if (is_object($o)) { + $rows[] = array(l($o->label, "islandora/object/{$o->id}")); + } + else { + $rows[] = array(t("@cmodel - (This content model is not in this Islandora repository.)", array('@cmodel' => $cmodel))); } } - $header = count($rows) > 1 ? t('Content Models') : t('Content Model'); - $table = theme('table', array( - 'header' => array($header), - 'rows' => $rows, - 'empty' => t('No Islandora content model associated with this object.'))); - return array('cmodels' => $table); } + $header = count($rows) > 1 ? t('Content Models') : t('Content Model'); + $table = theme('table', array( + 'header' => array($header), + 'rows' => $rows, + 'empty' => t('No Islandora content model associated with this object.'))); + return array('cmodels' => $table); }