You are here

public function FeedsItemUrlFormatter::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.

Overrides FeedsItemFormatterBase::generateLink

1 call to FeedsItemUrlFormatter::generateLink()
FeedsItemUrlFormatter::viewElements in src/Plugin/Field/FieldFormatter/FeedsItemUrlFormatter.php
Builds a renderable array for a field value.

File

src/Plugin/Field/FieldFormatter/FeedsItemUrlFormatter.php, line 102

Class

FeedsItemUrlFormatter
Plugin implementation of the 'feeds_item_url' formatter.

Namespace

Drupal\feeds\Plugin\Field\FieldFormatter

Code

public function generateLink(Url $url) {
  if ($this
    ->getSetting('url_plain')) {

    // Render url as plain text.
    return [
      '#plain_text' => $url
        ->toString(),
    ];
  }
  return parent::generateLink($url);
}