diff --git a/includes/breadcrumb.inc b/includes/breadcrumb.inc index b0e7beed..38be8322 100644 --- a/includes/breadcrumb.inc +++ b/includes/breadcrumb.inc @@ -77,58 +77,50 @@ function islandora_get_breadcrumbs_recursive($pid, FedoraRepository $repository, ); } else { - - - $query= << - PREFIX fedora-rels-ext: - SELECT DISTINCT ?object ?label - FROM <#ri> - WHERE { + + $query = << + PREFIX fedora-rels-ext: + SELECT DISTINCT ?object ?label + FROM <#ri> + WHERE { ?collection_predicate ?object; - ?label . - ?object - . - !optionals - !filters - } + ?label . + ?object + . + !optionals + !filters + } EOQ; - - $query_optionals = (array) module_invoke('islandora_xacml_api', 'islandora_basic_collection_get_query_optionals', 'view'); - $query_filters = (array) module_invoke('islandora_xacml_api', 'islandora_basic_collection_get_query_filters'); - $filter_map = function ($filter) { - return "FILTER($filter)"; - }; - $query_filters[] = "sameTerm(?collection_predicate, ) || sameTerm(?collection_predicate, )"; - - - - $query = format_string($query, array( - '!optionals' => !empty($query_optionals) ? ('OPTIONAL {{' . implode('} UNION {', $query_optionals) . '}}') : '', - '!filters' => implode(' ', array_map($filter_map, $query_filters)), - )); + $query_optionals = (array) module_invoke('islandora_xacml_api', 'islandora_basic_collection_get_query_optionals', 'view'); + $query_filters = (array) module_invoke('islandora_xacml_api', 'islandora_basic_collection_get_query_filters'); + $filter_map = function ($filter) { + return "FILTER($filter)"; + }; + $query_filters[] = "sameTerm(?collection_predicate, ) || sameTerm(?collection_predicate, )"; + $query = format_string($query, array( + '!optionals' => !empty($query_optionals) ? ('OPTIONAL {{' . implode('} UNION {', $query_optionals) . '}}') : '', + '!filters' => implode(' ', array_map($filter_map, $query_filters)), + )); $query = format_string($query, array( '!pid' => $pid, )); - $results = $repository->ri->sparqlQuery($query,'unlimited'); + $results = $repository->ri->sparqlQuery($query, 'unlimited'); - if (count($results) > 0 && $context['level'] > 0) { + if (count($results) > 0 && $context['level'] > 0) { $parent = $results[0]['object']['value']; $this_label = $results[0]['label']['value']; if (empty($this_label)) { - $this_label = t('-'); + $this_label = t('-'); } $context['level']--; - return array_merge( - islandora_get_breadcrumbs_recursive($parent, $repository, $context), - array( - l($this_label, "islandora/object/$pid"), - ) - ); + return array_merge(islandora_get_breadcrumbs_recursive($parent, $repository, $context), array( + l($this_label, "islandora/object/$pid"), + )); } else { // Add an non-link, as we don't know how to get back to the root, and