From 94c193138204f77ee6a7600a5ddeba7495fbbec0 Mon Sep 17 00:00:00 2001 From: Eli Zoller Date: Tue, 24 Nov 2020 09:12:23 -0700 Subject: [PATCH] fix toUrl method --- src/Plugin/Field/FieldFormatter/IslandoraImageFormatter.php | 2 +- tests/src/Functional/IslandoraImageFormatterTest.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Plugin/Field/FieldFormatter/IslandoraImageFormatter.php b/src/Plugin/Field/FieldFormatter/IslandoraImageFormatter.php index 9feecd14..a3ee788e 100644 --- a/src/Plugin/Field/FieldFormatter/IslandoraImageFormatter.php +++ b/src/Plugin/Field/FieldFormatter/IslandoraImageFormatter.php @@ -124,7 +124,7 @@ class IslandoraImageFormatter extends ImageFormatter { return $elements; } - $url = $node->toUrl()->toString(); + $url = $node->toUrl(); foreach ($elements as &$element) { $element['#url'] = $url; diff --git a/tests/src/Functional/IslandoraImageFormatterTest.php b/tests/src/Functional/IslandoraImageFormatterTest.php index 6baf1bfc..9572b1e7 100644 --- a/tests/src/Functional/IslandoraImageFormatterTest.php +++ b/tests/src/Functional/IslandoraImageFormatterTest.php @@ -78,11 +78,12 @@ class IslandoraImageFormatterTest extends IslandoraFunctionalTestBase { // Assert that the image is rendered into html as a link pointing // to the Node, not the Media (that's what the islandora_image // formatter does). + $elements = $this->xpath( '//a[@href=:path]/img[@src=:url and @alt=:alt and @title=:title]', [ ':path' => $node->toUrl()->toString(), - ':url' => file_url_transform_relative(file_create_url($file->getFileUri())), + ':url' => $file->createFileUrl(), ':alt' => 'Some Alt', ':title' => 'Some Title', ]