You are here

public function InstallableLibrary::getVersionLink in Markdown 8.2

Retrieves the version as a link to a specific release.

Parameters

string $version: A specific version to retrieve a URL for. If not specified, it will default to the currently installed version.

string|\Drupal\Component\Render\MarkupInterface $label: The label to use for the link. If not specified, it will default to the versionExtra or version value.

array $options: Optional. Options to pass to the creation of the URL object.

Return value

\Drupal\Core\GeneratedLink|void The link to the version.

File

src/Annotation/InstallableLibrary.php, line 275

Class

InstallableLibrary

Namespace

Drupal\markdown\Annotation

Code

public function getVersionLink($version = NULL, $label = NULL, array $options = []) {
  if (!$version) {
    $version = $this->version;
    if (!isset($label)) {
      $label = $this->versionExtra ?: $this->version;
    }
  }
  if ($version && ($url = $this
    ->getVersionUrl($version, $options))) {
    if (!isset($label)) {
      $label = $version;
    }
    return Link::fromTextAndUrl($label, $url)
      ->toString();
  }
}