Join the Webstudio community

Updated 2 months ago

Simple Data Transformation in Expression Editor

At a glance

The community member is requesting the ability to perform simple data transformations directly within the expression editor, as they are currently using GraphQL to fetch site settings from Headless WordPress, but the language/locale is returned in a format (en_AU) that differs from what Webstudio expects (en-AU). They provide an example expression to transform the format, and ask if it would be possible to support such transformations directly in the expression editor.

In the comments, another community member responds that this functionality is not currently available, as methods are disabled for security reasons.

I’m not sure if this functionality already exists, but it would be great to have simple data transformation options in the expression editor. This would make it easier to work with existing backends.

For example, with the new global variables feature, I’m using GraphQL to fetch site settings from Headless WordPress. However, the language/locale is returned as en_AU, whereas Webstudio expects en-AU.

I tried using the following expression to transform the format:
siteSettings.data.data.allSettings.generalSettingsLanguage.replace('_', '-')

Would it be possible to support transformations like this directly within the expression editor?
B
1 comment
Not at the moment. Methods are disabled for security reasons.
Add a reply
Sign up and join the conversation on Discord