Hi Forum, my apologies if this is already covered, please point me to the resource in that case!
I'm wondering if it's possible to "nest" code modules, i.e. calling in the entire functionality from a module in another module.
In this case I have a 2-column layout thing with left and right containers, which can hold rich text, image, video embed or a blog list. The content editor selects the type of content from a switch in the module.
So Hubspot has this ready-made video-embed module that pulls in Youtube or Vimeo clips. Can I somehow reference that whole module from my module and get it to work? Or do I need to copy the entire video module code into my module? Seems like bad practice to duplicate code like this.
I was hoping for something as simple as in the below, like "if 'video' is selected, enable this video module".
In both the design manager and local dev with the CLI, you will get an error showing that "'module' is disabled in this context" - so unfortunately I don't think that this is possible to do and you would need to add the code directly to your module.
In both the design manager and local dev with the CLI, you will get an error showing that "'module' is disabled in this context" - so unfortunately I don't think that this is possible to do and you would need to add the code directly to your module.
The way Hubspot solves for this is interesting. This is where Macros come in. You can create your "atoms" as macros then call them in other components to achieve what, in some CMSs are known as "complex components"--or combining multiple components to achieve a single experience.
There is no way to call a module within a module in hubspot. So you have to create the element you want to repurpose as a macro.
Just remember that your component field JSON has to match to get a consistent authoring/display experience.
I'm pretty sure it was this dhug video that helped me understand the macro as the solution to the complex component.