You are here

public function BibciteLinkPluginBase::build in Bibliography & Citation 8

Same name and namespace in other branches
  1. 2.0.x modules/bibcite_entity/src/Plugin/BibciteLinkPluginBase.php \Drupal\bibcite_entity\Plugin\BibciteLinkPluginBase::build()

Build link using data from Reference entity.

Parameters

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

Return value

array Constructed URL render array or NULL if URL can not be constructed.

Overrides BibciteLinkPluginInterface::build

File

modules/bibcite_entity/src/Plugin/BibciteLinkPluginBase.php, line 32

Class

BibciteLinkPluginBase
Base class for Link plugins.

Namespace

Drupal\bibcite_entity\Plugin

Code

public function build(ReferenceInterface $reference) {
  if ($url = $this
    ->buildUrl($reference)) {
    return Link::fromTextAndUrl($this
      ->getLabel(), $url)
      ->toRenderable();
  }
  return NULL;
}