From 0d18931b073bb728bce562ce1dc26aa3d2beba96 Mon Sep 17 00:00:00 2001 From: Seth Shaw Date: Wed, 2 Oct 2019 10:53:14 -0700 Subject: [PATCH] Make fedora uri available on taxonomy terms (issue-1288) (#174) * make fedora uri available on taxonomy terms * don't need to load route entities (again) * tighten up the entity check * coding standards --- islandora.module | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/islandora.module b/islandora.module index dda56c8c..2e3107a1 100644 --- a/islandora.module +++ b/islandora.module @@ -379,11 +379,9 @@ function islandora_entity_extra_field_info() { * Implements hook_entity_view(). */ function islandora_entity_view(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) { - $route_match_item = \Drupal::routeMatch()->getParameters()->all(); - // Get the parameter, which might be node, media or taxonomy term. - $current_entity = reset($route_match_item); - // Match exactly to ensure they are the same entity type too. - if ($entity === $current_entity) { + $route_match_item = \Drupal::routeMatch()->getParameters()->get($entity->getEntityTypeId()); + // Ensure the entity matches the route. + if ($entity === $route_match_item) { if ($display->getComponent('field_gemini_uri')) { $gemini = \Drupal::service('islandora.gemini.lookup'); if ($gemini instanceof GeminiLookup) {