Skip to content

Commit

Permalink
fixed error with entity
Browse files Browse the repository at this point in the history
  • Loading branch information
wilso929 authored and wilso929 committed Oct 30, 2023
1 parent e37936b commit 695bcd0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Plugin/Field/FieldFormatter/ReplayWebPageFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,11 @@ public function settingsSummary() {
*/
public function viewElements(FieldItemListInterface $items, $langcode) {
$element = [];
$ent = $items->getEntity();
/** @var \Drupal\media\Entity\Media $media */
$media = $items->getEntity();

if ($ent->hasField('field_base_url') && $ent->hasField('field_media_file')) {
if ($media->hasField('field_base_url') && $media->hasField('field_media_file')) {
// get direct path to file
/** @var \Drupal\media\Entity\Media $media */
$media = $ent;
$fid = $media->getSource()->getSourceFieldValue($media);
$file = File::load($fid);
$uri = $file->getFileUri();
Expand Down

0 comments on commit 695bcd0

Please sign in to comment.