|
|
@ -41,8 +41,9 @@ class DoiFieldFormatter extends FormatterBase { |
|
|
|
|
|
|
|
|
|
|
|
foreach ($items as $delta => $item) { |
|
|
|
foreach ($items as $delta => $item) { |
|
|
|
$prefix = 'https://doi.org/'; |
|
|
|
$prefix = 'https://doi.org/'; |
|
|
|
|
|
|
|
// Assumes all field values are just plain text or strings values and not full doi URLS. |
|
|
|
$doiUrl = $prefix . $item->value; |
|
|
|
$doiUrl = $prefix . $item->value; |
|
|
|
$link = Link::fromTextAndUrl($item->value, Url::fromUri($doiUrl)); |
|
|
|
$link = Link::fromTextAndUrl($doiUrl, Url::fromUri($doiUrl)); |
|
|
|
$element[$delta] = [$link->toRenderable()]; |
|
|
|
$element[$delta] = [$link->toRenderable()]; |
|
|
|
} |
|
|
|
} |
|
|
|
return $element; |
|
|
|
return $element; |
|
|
|