CMS Development


Custom "inserts" of module snippets to a Rich Text field or other workaround?

I'd like to be able to store module snippets for users to insert when editing a custom module with Rich Text.  It would be great if we could extnd this to other areas outside a custom module as well.  


In essence, we are trying to achieve a "shortcut" to insert the output of a module while in the page builder.  We can copy/paste the module's snippet into a Rich Text Editor field (RTEF), and the module renders fine.  But finding the module snippets is not easy, and has to be documented elsewhere currently. 


I realize modules cannot be Drag and Drop (DND) directly into another module, so this is the only workaround we have so far  - to paste that module's "snippet" into a RTEF


Currently we have to paste it in like this:





We'd like to be able to refer to inserting that module snippet in an easier way - perhaps the "insert" menu in a RTEF:


Screen Shot 2021-11-24 at 10.16.01 AM.png


Any ideas how to add somethign to the "insert" capabilities in the editor?  Other ideas on how you insert module snippets other than keeping a library of them and pasting them in directly? 

0 いいね!
ガイド役 | Elite Partner
ガイド役 | Elite Partner

Custom "inserts" of module snippets to a Rich Text field or other workaround?



I'm also looking for this kind of feature to add modules inside modules to expand the default features.


If you have created a custom module, you can use a replace function withing the module.


 So your code example will look like this:

{{ module.text|replace('[city]', module.city_name_hubdb.columns.city_name) }}


See the screenshot for setting up the custom module:

Schermafbeelding 2021-11-24 om 23.48.47.png 

Hope this will make life easier!

Bureau Vet

Did my post solve your question? Help the community by marking it as a solution