Issue with pasting code turning into personnalization token

Hi,

A little glitch is giving me a massive headache here. I am trying to copy a HubL code {{ module.something.etc }} into a Rich text field. When copying it converts it into {{personalization_token(‘module.something.etc’), ‘undefined’}}.

If I click Publish the code works fine.

If I click Publish and then come back to edit, it won’t work. Same if I go in “View code”.

Any idea on how to cope with this ?

Thank you very much for your help,

Hi @YeSpaniard,

it’s technically not possible to paste modules into rich-text fields.
What do you want to achieve?

Personally I always recommend you to create a whole custom module with your desired functionality.

best,

Anton

Hi Anton,

Thanks for getting back to me.

Actually I can copy it and make it work but I cannot edit it easily after it’s published (otherwise I’d have to delete the “personnalizatino token” line).

The idea is to create tooltip module that I could insert wherever I want in a RTF module. So basically insert a user-editable HTML snippet, with a simple line/shortcode.

Gotcha!

My personal approach would be a custom module with a RTF and a dedicated field for the tooltip. Since it’s easier for the user and isn’t so error prone.

A custom module could look like this:

<article title="{{ module.tooltip }}">
{{ module.richtext_field }}
</article>

And here are the fields

If you want more flexibility you can create custom shortcodes like in WordPress. @Teun has created a deepdive video how to create such.

best,

Anton