CMS Development

Hawk-Steve
Top Contributor

Hubl snippet fields in multiple places

Hi all,

 

Is it possible to create a single global custom module, create several fields (such as rich text) and call on those fields instead of the whole custom module? I gave the developer documentation a go but couldn't seem to find a straight answer.

https://designers.hubspot.com/docs/hubl/hubl-module-syntax-and-parameters

 

I was hoping something like this would be possible, combining the module snippet with the field snippet into 1.

{% module "module_1563543741241145" module_id="8676118" label="Test bali - Text" %}
+

{% inline_rich_text field="Lose_yourself" value="{{ module.Lose_yourself }}" %}

 

<table>
  <tr>
    <td>
      {% module "module_1563542289275103" module_id="8676118" label="Test bali - Text" inline_rich_text field="Lose_yourself" value="{{ module.Lose_yourself }}" %}
    </td>
  </tr>
  <tr>
    <td>
      {% module "module_1563542289275103" module_id="8676118" label="Test bali - Text" inline_rich_text field="Country" value="{{ module.Country }}" %}
    </td>
  </tr>
  <tr>
    <td>
      {% module "module_1563542289275103" module_id="8676118" label="Test bali - Text" inline_rich_text field="intro_text" value="{{ module.intro_text }}" %}
    </td>
  </tr>
</table>

Thanks for any help you can offer!

 

Steve

1 Reply 1
lscanlan
HubSpot Alumni
HubSpot Alumni

Hubl snippet fields in multiple places

Hi @Hawk-Steve,

 

Are you trying to access only the field value, and then insert that into the HTML? That's possible if you copy the value only for that field. So if for example you have a rich text field labeled "My rich text" and internally named "my_rich_text", you can access the value from within the custom module with {{ module.my_rich_text }}. So in the HTML + HubL field, that might look something like:

 

<div class="my-rich-text">
  {{ module.my_rich_text }}
</div>

Does that help or have I misunderstood what your goal is here? I'm happy to take a closer look, so let me know.

 

Leland Scanlan

HubSpot Developer Support
0 Upvotes