diff --git a/islandora.links.menu.yml b/islandora.links.menu.yml index 07fe2ea9..7d69b3d6 100644 --- a/islandora.links.menu.yml +++ b/islandora.links.menu.yml @@ -12,9 +12,9 @@ system.islandora_settings: route_name: system.islandora_settings description: 'Confgure core Islandora settings' -# Field to RDF property mappings +# RDF property mappings system.islandora_rdf_mappings: - title: 'RDF field mappings' + title: 'Field and term RDF mappings' parent: system.admin_reports - description: 'List of configured Drupal field to RDF property mappings.' + description: 'List of configured Drupal field to RDF property mappings and taxonomy term linked data URIs.' route_name: system.islandora_rdf_mappings diff --git a/islandora.routing.yml b/islandora.routing.yml index 297a74f3..310a702b 100644 --- a/islandora.routing.yml +++ b/islandora.routing.yml @@ -16,12 +16,12 @@ system.islandora_settings: requirements: _permission: 'administer site configuration' -# RDF mappings report +# RDF properties report system.islandora_rdf_mappings: path: '/admin/reports/islandora/rdf_mappings' defaults: _controller: '\Drupal\islandora\Controller\RdfMappingsReportController::main' - _title: 'Drupal field to RDF property mappings' + _title: 'Field and term RDF mappings' requirements: _permission: 'administer site configuration' diff --git a/src/Controller/RdfMappingsReportController.php b/src/Controller/RdfMappingsReportController.php index f0cb65e5..38a80994 100644 --- a/src/Controller/RdfMappingsReportController.php +++ b/src/Controller/RdfMappingsReportController.php @@ -18,10 +18,9 @@ class RdfMappingsReportController extends ControllerBase { * Markup of the tables. */ public function main() { - $markup = ''; - $entity_types = ['node', 'media']; + // Configured namespaces. $namespaces = rdf_get_namespaces(); $namespaces_table_rows = []; foreach ($namespaces as $alias => $namespace_uri) { @@ -38,6 +37,8 @@ class RdfMappingsReportController extends ControllerBase { $markup .= '
' . t('RDF namespaces used in field mappings') . '
' . $namespaces_table_markup . '
'; + // Node and media field to RDF property mappings. + $entity_types = ['node', 'media']; $markup .= '

' . t('Field mappings') . '

'; foreach ($entity_types as $entity_type) { $bundles = \Drupal::service('entity_type.bundle.info')->getBundleInfo($entity_type); @@ -70,9 +71,11 @@ class RdfMappingsReportController extends ControllerBase { } } - // Taxonomy terms with external URIs. - $markup .= '

' . t('Taxonomy terms with external URIs') . '

'; + // Taxonomy terms with external URIs or authority links. + $markup .= '

' . t('Taxonomy terms with external URIs or authority links') . '

'; $utils = \Drupal::service('islandora.utils'); + $uri_fields = $utils->getUriFieldNamesForTerms(); + $vocabs = Vocabulary::loadMultiple(); foreach ($vocabs as $vid => $vocab) { $vocab_table_header = []; @@ -90,16 +93,25 @@ class RdfMappingsReportController extends ControllerBase { $markup .= $vocab_table_markup; } else { - $vocab_table_header = [t('Term'), t('Term ID'), t('External URI')]; + $vocab_table_header = [ + t('Term'), + t('Term ID'), + t('External URI or Authority link'), + ]; $vocab_table_rows = []; foreach ($terms as $t) { $term = Term::load($t->tid); - $uri = $utils->getUriForTerm($term); - if (is_null($uri)) { - $vocab_table_rows[] = [$term->getName(), $term->id(), t('None')]; + foreach ($uri_fields as $uri_field) { + if ($term->hasField($uri_field) && !$term->get($uri_field)->isEmpty()) { + $uri = $term->get($uri_field)->first()->getValue(); + continue; + } + } + if (isset($uri) && !is_null($uri) && array_key_exists('uri', $uri)) { + $vocab_table_rows[] = [$term->getName(), $term->id(), $uri['uri']]; } else { - $vocab_table_rows[] = [$term->getName(), $term->id(), $uri]; + $vocab_table_rows[] = [$term->getName(), $term->id(), t('None')]; } } $vocab_table = [