CMS Development

OksanaR
Contributor

How convert a custom local module to a global module?

SOLVE

Hi guys, I'm new to HubSpot.
I have a custom local module, I need to make it global.
I read this but it doesn't work for me, I don't see any more buttons in the inspector where I can convert my module

OksanaR_0-1660728033508.png



0 Upvotes
1 Accepted solution
OksanaR
Solution
Contributor

How convert a custom local module to a global module?

SOLVE

Thanks for the solution, but I'm not using local development yet.
Therefore, I solved my problem like this: I created a new global module, copied the code there and created the necessary fields))). It wasn't difficult because my custom module has few fields, but if there were a lot of them, this method wouldn't work.
So thanks for the tips, I'll try to use them

View solution in original post

6 Replies 6
tone4407
Participant | Elite Partner
Participant | Elite Partner

How convert a custom local module to a global module?

SOLVE

 I was able to fix this issue by removing:

 

"locked" : true,

 

from all of the fields within the fields.json file.

 

This fix has to be done via the CLI.

0 Upvotes
BarryGrennan
Top Contributor

How convert a custom local module to a global module?

SOLVE

The local dev method @Anton  suggests is the way to go!

A quick note though, if you think there's a posibility that you'll need the local version again down the line, I'd save a copy of it.

 

There's a bug a few of us have encountered in that scenario. Quoting @Stephanie-OG who described the bug succinctly: 

 

When you change a module's parameter from "global": true  to "global": false  in the meta.json file, in the editor it's no longer showing the global overlay, but when you click into it it has the "The creator of this template prevented editing this module in the content editors." message.

 

Don't know if that bug still exists. But it did 3 months ago and a year ago in my case.

 

I was able to use revision history to roll back to a pre-bug state, but that might be a pain in the **bleep** if you've made substantial changes to your module by then.

 


profile2022aBarry Grennan

Freelance HubSpot CMS Developer

Website | Contact

 

 

Albusis
Contributor

How convert a custom local module to a global module?

SOLVE

I feel your pain. The bug is still there, although.....

 

When you open the JSON file of that module, it will have for every subsection a parameter "locked: true". In my case, I just went through the file and marked it all as "locked: false"

Albusis_0-1699818040815.png

 

and hey, now I can edit it 🙂 

OksanaR
Contributor

How convert a custom local module to a global module?

SOLVE

Thanks for the tips, I'll try to use them

Anton
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

How convert a custom local module to a global module?

SOLVE

Hi @OksanaR

you can do it by modifing the meta.json file via local development

 

It will look something like this

{
  "label": "My custom module",
  "css_assets": [],
  "external_js": [],
  "global": false,
  "help_text": "",
  "host_template_types": [
    "PAGE",
    "BLOG_POST",
    "BLOG_LISTING"
  ],
  "js_assets": [],
  "other_assets": [],
  "smart_type": "NOT_SMART",
  "tags": [],
  "is_available_for_new_content": false
}

 

if you change it like this,the module will be global

"global": true,

 

BUT: unless you have all settings predefined as default values, you'll lose them.

 

 

best, 

Anton

Anton Bujanowski Signature
OksanaR
Solution
Contributor

How convert a custom local module to a global module?

SOLVE

Thanks for the solution, but I'm not using local development yet.
Therefore, I solved my problem like this: I created a new global module, copied the code there and created the necessary fields))). It wasn't difficult because my custom module has few fields, but if there were a lot of them, this method wouldn't work.
So thanks for the tips, I'll try to use them