diff --git a/composer.json b/composer.json index 7d564a4..a6505ae 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "drupal/fontawesome": "^3.0", "drupal/geolocation": "^3.1", "drupal/layout_paragraphs": "^2.0", - "drupal/office_hours": "1.27", + "drupal/office_hours": "1.28", "drupal/paragraphs": "^1.13", "drupal/tablefield": "^3.0@beta", "drupal/viewsreference": "^2.0", diff --git a/modules/localgov_subsites_paragraphs/localgov_subsites_paragraphs.module b/modules/localgov_subsites_paragraphs/localgov_subsites_paragraphs.module index 741c03e..135b3e6 100644 --- a/modules/localgov_subsites_paragraphs/localgov_subsites_paragraphs.module +++ b/modules/localgov_subsites_paragraphs/localgov_subsites_paragraphs.module @@ -5,6 +5,7 @@ * LocalGovDrupal Subsites Paragraphs module file. */ +use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Link; use Drupal\Core\StringTranslation\ByteSizeMarkup; use Drupal\Core\Url; @@ -143,8 +144,9 @@ function localgov_subsites_paragraphs_preprocess_paragraph(&$variables) { $button = $paragraph->get('localgov_button')->first()->getValue(); $variables['button_url'] = Url::fromUri($button['uri']); } - if (!$paragraph->get('localgov_background_image')->isEmpty()) { - $fid = $paragraph->get('localgov_background_image')->entity->field_media_image[0]->getValue()['target_id']; + $background_image = $paragraph->get('localgov_background_image')->entity; + if ($background_image instanceof EntityInterface) { + $fid = $background_image->field_media_image[0]->getValue()['target_id']; $file_url = File::load($fid)->getFileUri(); // Get the image url for the background, falling back to the full