diff --git a/composer.json b/composer.json index 9475b79..e512568 100644 --- a/composer.json +++ b/composer.json @@ -29,5 +29,8 @@ "drush.services.yml": "^9" } } + }, + "require": { + "drupal/focal_point": "^2.1" } } diff --git a/responsive_image_effect.info.yml b/responsive_image_effect.info.yml index 02fa6cb..e0ab7c8 100644 --- a/responsive_image_effect.info.yml +++ b/responsive_image_effect.info.yml @@ -1,10 +1,11 @@ name: Responsive image effect description: Replaces Drupal image style url generator with a scale and crop image effect that can be specified via URL arguments. package: Media -core_version_requirement: ^9.4 || ^10 +core_version_requirement: ^10 || ^11 type: module dependencies: - drupal:image - - drupal:focal_point + - focal_point:focal_point + - drupal:media diff --git a/src/Entity/ResponsiveImageStyle.php b/src/Entity/ResponsiveImageStyle.php index 06cba22..e40c40c 100644 --- a/src/Entity/ResponsiveImageStyle.php +++ b/src/Entity/ResponsiveImageStyle.php @@ -5,6 +5,7 @@ use Drupal\Core\File\Exception\FileException; use Drupal\Core\StreamWrapper\StreamWrapperInterface; use Drupal\Core\StreamWrapper\StreamWrapperManager; +use Drupal\Core\Utility\Error; use Drupal\image\Entity\ImageStyle; class ResponsiveImageStyle extends ImageStyle { @@ -71,7 +72,8 @@ public function flush($path = NULL) { } } catch (\Exception $e) { - watchdog_exception('responsive_image_effect', $e, 'problem finding responsive image derivatives'); + $logger = \Drupal::logger('responsive_image_effect'); + Error::logException($logger, $e); } return $this; diff --git a/src/PathProcessor/PathProcessorImageStyles.php b/src/PathProcessor/PathProcessorImageStyles.php index c58069d..dc61c9e 100644 --- a/src/PathProcessor/PathProcessorImageStyles.php +++ b/src/PathProcessor/PathProcessorImageStyles.php @@ -96,10 +96,11 @@ public function processInbound($path, Request $request) { * Return true/false if the responsive image effect is set. */ protected function imageStyleHasResponsiveEffect($image_style) { - $image_style = ImageStyle::load($image_style); - foreach ($image_style->getEffects() as $effect) { - if ($effect instanceof ResponsiveImageEffect) { - return TRUE; + if ($image_style = ImageStyle::load($image_style)) { + foreach ($image_style->getEffects() as $effect) { + if ($effect instanceof ResponsiveImageEffect) { + return TRUE; + } } } return FALSE;