When I pass my ACF text field as an argument in an echo tag, I have the problem of the string breaking if there is a single quote in it.
Example echo tag: {echo:my_text_function(‘{acf_text_field}’)}
Example string: Everyone’s Going This Weekend
What the php function ends up with just “Everyone”, breaking at the first single quote. If I pass {post_title} instead with a quote in it, that works fine, so it’s specific to when I pass an ACF text field.
If I wrap the argument in double quotes, that doesn’t work at all (would be a good solution).
If I don’t wrap it at all, then the string ends up with missing spaces (is that expected behaviour?)
I need a way to pass ACF text values as arguments while preserving their single quote content.
That would be the correct approach (no wrapping with single quotes needed). But yes, I can replicate the issue with removed spaces, so it’s a bug.
I’ve created an internal task for this and we will update this topic once we release a fix.
Eventually, the wrapping with single quotes should also be supported, and I can see that wrapping with single quotes + a single quote inside the dynamic data is indeed an issue. But, we already have a report (internal task) for that.
I have been confronted with bug in my latest project (using Bricks Builder 2.3.3). For now, I have instructed my customer to use the HTML entity for single quotes to circumvent the problem, but do we have any insight on when a fix could make it into an upcoming update?
We’ve addressed this in Bricks 2.4-beta (beta release), now available for manual download from your Bricks account.
Please read the changelog entry before testing, and let us know if you experience any issues. Note: beta builds are not recommended for production sites.