3 namespace Drupal\file\Plugin\Field\FieldFormatter;
5 use Drupal\Core\Field\FieldItemListInterface;
8 * Plugin implementation of the 'file_url_plain' formatter.
11 * id = "file_url_plain",
12 * label = @Translation("URL to file"),
18 class UrlPlainFormatter extends FileFormatterBase {
23 public function viewElements(FieldItemListInterface $items, $langcode) {
26 foreach ($this->getEntitiesToView($items, $langcode) as $delta => $file) {
28 '#markup' => file_url_transform_relative(file_create_url($file->getFileUri())),
30 'tags' => $file->getCacheTags(),