XF 2.3 Trying to use a Phrase that includes an icon as a Post message content results in raw HTML -- Suggestions?

Kevin

Well-known member
Licensed customer
Using XF 2.3 I'm programmatically adding a Post to an existing thread. The content of the new post is a phrase. The phrase includes an icon.

The problem I'm having is that the new post is showing the raw HTML for the icon. I've tried a few different changes and so far my attempts all result in either the raw HTML or the HTML for the icon being removed entirely.

Here's what I'm trying to do....

Phrase with the icon: This listing has completed. {icon:fas::check}

Variable in my code that grabs the phrase: $archiveMessage = \XF::phrase('cinvin_complete_post_manual')->render();

... and for creating the actual post I'm using the snippet from Chris in this post.

Here's the resulting post I'm getting...
1792935654026.webp


My attempts so far at a solution feels more like I'm just stumbling in the dark so I'd really appreciate any help with this one.

Thanks
 
You could create an icon BB-Code and then use that in the phrase instead. Otherwise there's not really a way of getting them to appear in posts, they're rendered via HTML.
 
You could create an icon BB-Code and then use that in the phrase instead. Otherwise there's not really a way of getting them to appear in posts, they're rendered via HTML.
Thanks, Jeremy. I'm actually happy to find out that there isn't a pure code solution as it means I didn't miss something in my experimenting. 😁

I ended up going with Plan B and used an emoji in the phrase in lieu of trying to use a FA icon.
 
Back
Top Bottom