I'm looking to dynamically replace the ℠ glyph with <sup>SM</sup>
in all rich text fields, since that glyph doesn't exist in the font we're using. I'd like to avoid having to call the |replace
filter on every field in every template, and I can't seem to get the customAsciiCharMappings
general config setting to work either (I'm not sure if I really understand what it does). Does Craft have something like a global replace function/filter?
customAsciiCharMappings
won't help you here.
There is the "Find and Replace" tool available to admins (Settings->Tools) in the Control Panel, but its' a one-off thing and searches/replaces against all textual field types (Plain Text, Rich Text, etc. both inside and outside of Matrix fields).
Honestly, probably just create a small Twig macro that wraps |replace
and use that wherever you're outputting Rich Text fields on the site.
-
Awesome, thanks! I'm not sure the macro would be more convenient than manually wrapping them all in
|replace
but that looks like the best way. – jtenclay Sep 15 '17 at 17:34