Skip to content
Snippets Groups Projects
Commit a31b9fe9 authored by Igor Biki's avatar Igor Biki
Browse files

ISTWCMS-5175: Update to UWService to handle removed image/media.

parent 44de0c82
No related branches found
No related tags found
1 merge request!178ISTWCMS-5175: Update to UWService to handle removed image/media.
...@@ -108,11 +108,11 @@ class UWService implements UWServiceInterface { ...@@ -108,11 +108,11 @@ class UWService implements UWServiceInterface {
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function prepareResponsiveImage(EntityInterface $entity, string $image_style): array { public function prepareResponsiveImage(?EntityInterface $entity, string $image_style): array {
// Ensure that we can load an entity on the media. // Ensure that we can load an entity on the media.
if (isset($entity->field_media_image->entity)) { if ($entity && isset($entity->field_media_image->entity)) {
// Load in the file object if we have one. // Load in the file object if we have one.
if ($file = $entity->field_media_image->entity) { if ($file = $entity->field_media_image->entity) {
......
...@@ -30,15 +30,15 @@ interface UWServiceInterface { ...@@ -30,15 +30,15 @@ interface UWServiceInterface {
/** /**
* Prepares responsive image. * Prepares responsive image.
* *
* @param \Drupal\Core\Entity\EntityInterface $entity * @param \Drupal\Core\Entity\EntityInterface|null $entity
* Image entity. * Image entity or null.
* @param string $image_style * @param string $image_style
* Image style to be used for responsive image. * Image style to be used for responsive image.
* *
* @return array * @return array
* Array with details for responsive image. * Array with details for responsive image.
*/ */
public function prepareResponsiveImage(EntityInterface $entity, string $image_style): array; public function prepareResponsiveImage(?EntityInterface $entity, string $image_style): array;
/** /**
* Get the UW images styles used in UW responsive image. * Get the UW images styles used in UW responsive image.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment