How to render tokens in a Widget?

Hi all,

I am developing a widget that allows the admin to provide a chunk of HTML that will be rendered when the widget is viewed.

As part of that I have defined two insertable tokens, that the admin to insert into the HTML editor.

Here is the relevant section of the Configuration.

<property id="html" dataType="html" rows="25" template="core_v2_customTokenizedHtml">
    <propertyValue value="firstname" labelText="First Name" />
    <propertyValue value="lastname" labelText="Last Name" />
</property>

Q: In the widget code, how can I replace those token with the actual values (that I grabbed from elsewhere)?

Is there an API for that, or do I just need to do a search and replace for "{firstname}" and "{lastname}" in the HTML?

Thanks.

Parents Reply Children
No Data