Skip to content

Escape posted “shortcodes” #13036

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

Merged
merged 3 commits into from
Apr 3, 2023

Conversation

brandonkelly
Copy link
Member

@brandonkelly brandonkelly commented Apr 3, 2023

Description

Adds a new normalizeValueFromRequest() method to field types, which will be called instead of normalizeValue() for values set on an element via a request’s post data.

(The base implementation in craft\base\Field just calls $this->normalizeValue() internally, so this is not a breaking change for existing field types.)

Plain Text and Table fields take advantage of the new method to avoid automatically converting things that look like shortcodes into emoji (#12935). They also now escape any unconverted shortcodes when serializing their values for the DB, so they won’t be confused for emoji shortcodes the next time the stored value is normalized.

Matrix fields have also been updated so that their sub-fields’ normalizeValueFromRequest() methods are called rather than normalizeValue(), when appropriate. (This change will need to be applied to Neo and Super Table as well.)

Related issues

@brandonkelly brandonkelly requested a review from a team as a code owner April 3, 2023 22:03
@linear
Copy link

linear bot commented Apr 3, 2023

DEV-1104 Escape posted “shortcodes”

“Shortcodes” that are explicitly posted to Plain Text fields and textual cells within Table fields should be escaped, so they don’t get converted to emoji.

[ci skip]
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.

1 participant