You are here

public function FeedsItemFormatterBase::generateLink in Feeds 8.3

Generates a link element from an Url value.

Parameters

\Drupal\Core\Url $url: The Url value you are creating a link with.

Return value

array A render array.

2 calls to FeedsItemFormatterBase::generateLink()
FeedsItemGuidFormatter::viewElements in src/Plugin/Field/FieldFormatter/FeedsItemGuidFormatter.php
Builds a renderable array for a field value.
FeedsItemUrlFormatter::generateLink in src/Plugin/Field/FieldFormatter/FeedsItemUrlFormatter.php
Generates a link element from an Url value.
1 method overrides FeedsItemFormatterBase::generateLink()
FeedsItemUrlFormatter::generateLink in src/Plugin/Field/FieldFormatter/FeedsItemUrlFormatter.php
Generates a link element from an Url value.

File

src/Plugin/Field/FieldFormatter/FeedsItemFormatterBase.php, line 40

Class

FeedsItemFormatterBase
Base class for the feeds item field formatters.

Namespace

Drupal\feeds\Plugin\Field\FieldFormatter

Code

public function generateLink(Url $url) {
  return [
    '#type' => 'link',
    '#url' => $url,
    '#title' => $url
      ->toString(),
  ];
}