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”.
I’m just a designer and self-taught coder.
Thanks!
<div class="page-center content-section">
<div class="two-column-highlight">
<!-- RICH TEXT BOX -->
<div class="highlight text {% if module.image_position =='img_left' %}image-left{% endif %}">
{% inline_rich_text field="highlight_text" value="{{ module.highlight_text }}" %}
</div>
<!-- OPTION: IMAGE -->
{% if module.media_content == 'image' %}
<div class="highlight {% if module.image_position =='img_left' %}image-left{% endif %}">
<img src="{{ module.image.src }}" alt="{{ module.image.alt }}" {{ sizeAttrs }}>
</div>
<!-- OPTION: VIDEO -->
{% elif module.media_content == 'video' %}
<div class="highlight {% if module.image_position =='img_left' %}image-left{% endif %}">
{% module "module_1587375821196241" path="@hubspot/video_embed_lp", label="Video Embed - LP" %}