Module Snippet

Highlighted
Occasional Contributor

Hi,

 

I created a custom code module. It's a local module.

 

I noticed that everytime I change something in the module, like adding a new field, the snippet to embed it in a template changes. Example:

 

Given snippet:

{% module "module_153391155118717" module_id="3486195" label="my_module" %}

-> adding a field to module.

Now snippet shows:

{% module "module_153391158798042" module_id="3486195" label="my_module" %}

But the templates of course still use the old snippet. Is this problematic? What is 

module "module_153391158798042"

good for?

Reply
0 Upvotes
2 Replies
Occasional Contributor

Hello there,

 

I think that won't really affect anything except for when you're trying to revert back to a previous version of that custom module you're working. As long as you have that same kind of 'module_id' you should be fine.

 

L

Reply
0 Upvotes
Occasional Contributor

Hey, thanks for the answer! I am not sure that piece of code is for versioning. I tried the following:

 

  • Use the snippet in a template
  • change the local module (adding 1 field)
  • snippet updates
  • the page that uses the template with the module still has the old snippet
  • checking that page  --> the new field shows up
  • putting the new snippet in the template --> all content for that module is lost, default values are shown
  • putting old snippet again --> content shows again

 

What this tells me is to never update the snippet on the page, because all module content will be lost. However, I would like to understand what exactly that piece of code 

module "module_153391158798042"

is actually good for. 

Reply
0 Upvotes