I tried looking for references in the docs but this is all I could find about it, no other documentation, no explanation on the parameters.
{% module_block module "my_rich_text_module" path="/My Rich Text Field Module",
label="My Rich Text Field Module"
%}
{% module_attribute "rich_text_field_variable" %}
<div>My HTML block</div>
{% end_module_attribute %}
{% end_module_block %}
I have been using widget_block for a while, and I tried to get this new module_block to work but it wouldn't. Is there any difference between using module_block, versus the traditional module @hubspot/rich_text?
widget_block has been deprecated and module_block is basically just a version 2 of it. It uses the exact same code pattern as widget_block, only major difference to keep in mind is that the type_of_module will usually never change from module whereas in widget_block it would be things like rich_text or raw_html. You can read a slightly more in depth explination on that here - https://developers.hubspot.com/docs/cms/building-blocks/modules/using-modules-in-templates#block-syn...
The code you've posted is more an example of if you're accessing a custom module. You can still access default HubSpot modules with module_block same as you would with widget_block. That code would look something like this:
widget_block has been deprecated and module_block is basically just a version 2 of it. It uses the exact same code pattern as widget_block, only major difference to keep in mind is that the type_of_module will usually never change from module whereas in widget_block it would be things like rich_text or raw_html. You can read a slightly more in depth explination on that here - https://developers.hubspot.com/docs/cms/building-blocks/modules/using-modules-in-templates#block-syn...
The code you've posted is more an example of if you're accessing a custom module. You can still access default HubSpot modules with module_block same as you would with widget_block. That code would look something like this: