Browse Source

Rendering media urls using Url Object instead of file->url()

logicp 7 years ago
parent
commit
13b6a0554b
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/Entity/Heartbeat.php

+ 2 - 2
src/Entity/Heartbeat.php

@@ -482,8 +482,8 @@ class Heartbeat extends RevisionableContentEntityBase implements HeartbeatInterf
           $file = \Drupal::entityTypeManager()->getStorage('file')->load($fileId);
 
           if ($file !== NULL && is_object($file)) {
-
-            $mediaObject = self::createHeartbeatMedia($field->getFieldDefinition()->getType(), $file->toUrl());
+            $url = \Drupal\Core\Url::fromUri($file->getFileUri());
+            $mediaObject = self::createHeartbeatMedia($field->getFieldDefinition()->getType(), $url->getUri());
             $types[] = $mediaObject;
 
           } else {