Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure DefineAssetUrlEvent is passed transform when parsing refs #16464

Merged
merged 2 commits into from
Jan 21, 2025

Conversation

timkelty
Copy link
Contributor

@timkelty timkelty commented Jan 21, 2025

Description

\craft\services\Elements::_getRefTokenReplacement coerces and an asset to a URL string via \craft\elements\Asset::__toString, which relies on any transform existing at \craft\elements\Asset::$_transform to get the correct transformed URL.

However, when the DefineAssetUrlEvent event is triggered and passed a transform, \craft\elements\Asset::$_transform is ignored.

Something using DefineAssetUrlEvent may then return the wrong URL, as receives a null transform when \craft\elements\Asset::$_transform is actually set.

This can end up interfering with HtmlField's Asset transform URL parsing, as it expects values to be identical for correct substitution when parsing refs, but they may not be.

Related issues

craftcms/ckeditor#336

[ci skip]
@brandonkelly brandonkelly merged commit e9b753f into 4.x Jan 21, 2025
@brandonkelly brandonkelly deleted the bugfix/ckeditor-transforms branch January 21, 2025 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants