You are here

public function PubMed::buildUrl in Bibliography & Citation 8

Same name and namespace in other branches
  1. 2.0.x modules/bibcite_entity/src/Plugin/bibcite/link/PubMed.php \Drupal\bibcite_entity\Plugin\bibcite\link\PubMed::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/PubMed.php, line 22

Class

PubMed
Build PubMed lookup link.

Namespace

Drupal\bibcite_entity\Plugin\bibcite\link

Code

public function buildUrl(ReferenceInterface $reference) {
  $pmid_field = $reference
    ->get('bibcite_pmid');
  if (!$pmid_field
    ->isEmpty()) {
    return Url::fromUri("https://www.ncbi.nlm.nih.gov/pubmed/{$pmid_field->value}?dopt=Abstract");
  }
  return NULL;
}