From 187db781723a0aa343f65192ff4d669d5f145e00 Mon Sep 17 00:00:00 2001 From: Tim Kelty Date: Mon, 20 Jan 2025 23:27:01 -0500 Subject: [PATCH 1/2] Ensure DefineAssetUrlEvent is passed the correct transform when parsing refs --- src/elements/Asset.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/elements/Asset.php b/src/elements/Asset.php index 67ff633a505..4a078a1c021 100644 --- a/src/elements/Asset.php +++ b/src/elements/Asset.php @@ -1924,6 +1924,8 @@ public function getUrl(mixed $transform = null, ?bool $immediately = null): ?str return null; } + $transform = $transform ?? $this->_transform; + // Give plugins/modules a chance to provide a custom URL $event = new DefineAssetUrlEvent([ 'transform' => $transform, @@ -1961,7 +1963,6 @@ private function _url(mixed $transform = null, ?bool $immediately = null): ?stri } $volume = $this->getVolume(); - $transform = $transform ?? $this->_transform; if ( $transform && ( From ba7979a11808fec71e943540d021e87a399a049e Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Tue, 21 Jan 2025 05:46:32 -0800 Subject: [PATCH 2/2] Release note [ci skip] --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6d0a337a3b..a39e16273ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Fixed an error that could occur when setting `relatedTo*` GraphQL arguments to `null`. ([#16433](https://github.com/craftcms/cms/issues/16433)) - Fixed a bug where old structure data wasn’t getting soft-deleted when a section was assigned a new structure UUID when applying project config changes. ([#16450](https://github.com/craftcms/cms/issues/16450)) +- Fixed a bug where `craft\events\DefineAssetUrlEvent::$transform` wasn’t always defined for assets’ `EVENT_BEFORE_DEFINE_URL` and `EVENT_DEFINE_URL` events. ([#16464](https://github.com/craftcms/cms/pull/16464)) ## 4.13.10 - 2025-01-14