You are here

public function DOI::buildUrl in Bibliography & Citation 2.0.x

Same name and namespace in other branches
  1. 8 modules/bibcite_entity/src/Plugin/bibcite/link/DOI.php \Drupal\bibcite_entity\Plugin\bibcite\link\DOI::buildUrl()

Build URL object.

Parameters

\Drupal\bibcite_entity\Entity\ReferenceInterface $reference: Reference entity object.

Overrides BibciteLinkPluginBase::buildUrl

File

modules/bibcite_entity/src/Plugin/bibcite/link/DOI.php, line 22

Class

DOI
Build DOI lookup link.

Namespace

Drupal\bibcite_entity\Plugin\bibcite\link

Code

public function buildUrl(ReferenceInterface $reference) {
  $doi_field = $reference
    ->get('bibcite_doi');
  if (!$doi_field
    ->isEmpty()) {
    return Url::fromUri("http://dx.doi.org/{$doi_field->value}");
  }
  return NULL;
}