You are here

protected function DownloadLinkFieldFormatter::viewValue in Media Entity Download 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldFormatter/DownloadLinkFieldFormatter.php \Drupal\media_entity_download\Plugin\Field\FieldFormatter\DownloadLinkFieldFormatter::viewValue()

Generate the output appropriate for one field item.

Parameters

\Drupal\Core\Field\FieldItemInterface $item: One field item.

Return value

string The textual output generated.

File

src/Plugin/Field/FieldFormatter/DownloadLinkFieldFormatter.php, line 76

Class

DownloadLinkFieldFormatter
Plugin implementation of the 'media_entity_download_download_link' formatter.

Namespace

Drupal\media_entity_download\Plugin\Field\FieldFormatter

Code

protected function viewValue(FieldItemInterface $item) {

  // The text value has no text format assigned to it, so the user input
  // should equal the output, including newlines.
  return nl2br(Html::escape($item->value));
}