From 291e9f5b8e778393474dc1e49d2d2c44440a60b0 Mon Sep 17 00:00:00 2001 From: tuutti Date: Mon, 16 Jan 2023 11:07:08 +0200 Subject: [PATCH 1/3] UHF-7946: Fixed issue with responsive image styles --- helfi_proxy.module | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/helfi_proxy.module b/helfi_proxy.module index 0c9dc3e..5c5a944 100644 --- a/helfi_proxy.module +++ b/helfi_proxy.module @@ -8,6 +8,20 @@ use Drupal\Core\Asset\AttachedAssetsInterface; use Drupal\Core\Entity\EntityInterface; +/** + * Implements hook_module_implements_alter(). + */ +function helfi_proxy_module_implements_alter(&$implementations, $hook) : void { + // Move helfi_proxy_file_url_alter() implementation to the top of the + // list, so this is always run first before any other alter hooks, more + // specifically before 'crop_file_url_alter()' which seems to convert certain + // responsive image styles to an external URL that will break our implementation. + if ($hook === 'file_url_alter') { + $group = $implementations['helfi_proxy']; + $implementations = ['helfi_proxy' => $group] + $implementations; + } +} + /** * Implements hook_file_url_alter(). */ From 05c6e80068892c224b615ae9e3b80afcae9b7d94 Mon Sep 17 00:00:00 2001 From: tuutti Date: Mon, 16 Jan 2023 11:07:50 +0200 Subject: [PATCH 2/3] UHF-7946: Added @see comment --- helfi_proxy.module | 1 + 1 file changed, 1 insertion(+) diff --git a/helfi_proxy.module b/helfi_proxy.module index 5c5a944..3acee2c 100644 --- a/helfi_proxy.module +++ b/helfi_proxy.module @@ -16,6 +16,7 @@ function helfi_proxy_module_implements_alter(&$implementations, $hook) : void { // list, so this is always run first before any other alter hooks, more // specifically before 'crop_file_url_alter()' which seems to convert certain // responsive image styles to an external URL that will break our implementation. + // @see UHF-7946. if ($hook === 'file_url_alter') { $group = $implementations['helfi_proxy']; $implementations = ['helfi_proxy' => $group] + $implementations; From 049c30910f74e135673c12ef01c0bb9a2cc93e21 Mon Sep 17 00:00:00 2001 From: tuutti Date: Mon, 16 Jan 2023 11:28:52 +0200 Subject: [PATCH 3/3] UHF-7946: phpcs fix --- helfi_proxy.module | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helfi_proxy.module b/helfi_proxy.module index 3acee2c..fa91826 100644 --- a/helfi_proxy.module +++ b/helfi_proxy.module @@ -15,8 +15,8 @@ function helfi_proxy_module_implements_alter(&$implementations, $hook) : void { // Move helfi_proxy_file_url_alter() implementation to the top of the // list, so this is always run first before any other alter hooks, more // specifically before 'crop_file_url_alter()' which seems to convert certain - // responsive image styles to an external URL that will break our implementation. - // @see UHF-7946. + // responsive image styles to an external URL that will break our + // implementation. @see UHF-7946. if ($hook === 'file_url_alter') { $group = $implementations['helfi_proxy']; $implementations = ['helfi_proxy' => $group] + $implementations;