From 747de76b53d19f96ce93e4bbf3c9aa28f4f00c72 Mon Sep 17 00:00:00 2001 From: tadean <51835841+tadean@users.noreply.github.com> Date: Fri, 12 Jul 2024 10:21:03 -0700 Subject: [PATCH] Fixes #3544 AZBackgroundMediaFormatter Breaks with Missing Files (#3545) --- .../Plugin/Field/FieldFormatter/AZBackgroundMediaFormatter.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/custom/az_paragraphs/src/Plugin/Field/FieldFormatter/AZBackgroundMediaFormatter.php b/modules/custom/az_paragraphs/src/Plugin/Field/FieldFormatter/AZBackgroundMediaFormatter.php index f1a70247b1..bf87702766 100644 --- a/modules/custom/az_paragraphs/src/Plugin/Field/FieldFormatter/AZBackgroundMediaFormatter.php +++ b/modules/custom/az_paragraphs/src/Plugin/Field/FieldFormatter/AZBackgroundMediaFormatter.php @@ -584,6 +584,9 @@ protected function image(array $settings, MediaInterface $media): array { $css_settings = $settings['css_settings']; $fid = $media->getSource()->getSourceFieldValue($media); $file = $this->entityTypeManager->getStorage('file')->load($fid); + if (empty($file)) { + return $az_background_media; + } $file_uri = $file->getFileUri(); if ($settings['style'] !== 'bottom') {