From d697c8e476c61cfdaff2c0d4b1d5082d11e3c171 Mon Sep 17 00:00:00 2001 From: Paul Pound Date: Mon, 7 Oct 2024 11:35:21 -0300 Subject: [PATCH] display full doi url not just the doi as a link --- src/Plugin/Field/FieldFormatter/DoiFieldFormatter.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Plugin/Field/FieldFormatter/DoiFieldFormatter.php b/src/Plugin/Field/FieldFormatter/DoiFieldFormatter.php index d769aa6..0c35c4b 100644 --- a/src/Plugin/Field/FieldFormatter/DoiFieldFormatter.php +++ b/src/Plugin/Field/FieldFormatter/DoiFieldFormatter.php @@ -41,8 +41,9 @@ class DoiFieldFormatter extends FormatterBase { foreach ($items as $delta => $item) { $prefix = 'https://doi.org/'; + // Assumes all field values are just plain text or strings values and not full doi URLS. $doiUrl = $prefix . $item->value; - $link = Link::fromTextAndUrl($item->value, Url::fromUri($doiUrl)); + $link = Link::fromTextAndUrl($doiUrl, Url::fromUri($doiUrl)); $element[$delta] = [$link->toRenderable()]; } return $element;