Browse Source

fix toUrl method

d9_islandora
Eli Zoller 4 years ago
parent
commit
94c1931382
  1. 2
      src/Plugin/Field/FieldFormatter/IslandoraImageFormatter.php
  2. 3
      tests/src/Functional/IslandoraImageFormatterTest.php

2
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;

3
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',
]

Loading…
Cancel
Save