Adding coded HubL fields to v2 custom module



I'm creating a tagging module for landing pages since we can't currently apply tags to them by default, just to blog posts.

I'm using the new design manager, and have created a custom module. Rather than use the helper tools on the right, I need to code the 'choice' module as it is fetching data from a HubDB table. Here's the code:

{% set table = hubdb_table_rows(679981) %}

{% set names = table|map(attribute='name') %}

{% set choices = names|join(', ') %}

{% choice "content_type_tag" label="Content Type" choices="{{ choices }}" %}

Printing {{ names|join(', ') }} gives a comma separated list, as the choice module expects, and the code validates.

However, when I preview the module I get "This module does not have any editable options.". In fact, even adding HubL for a simple text field doesn't show any editable field in the editor.

Found some info here:

"In addition to the standard fields, custom modules also support all other HubL statements and expressions. Using HubL greatly expands the potential of what you can do with custom modules. For example, you could add CTAs, forms, menus, etc. to a reusable custom module. However, please note that modules defined within a custom module will not render as part of the custom module in the content editor."

Not sure that makes any sense - if they don't render, what's the point?

Also more info here :

"While these modules support all HubL, HubL modules defined in a custom module will render in the Edit Modules pane of the editor, rather than within the custom module's options in the content editor."

Again, I can't make sense of that. Nowhere when editing the page is there the editable choice field, it's there it just can't be edited.

Appreciate if somebody from HubSpot could clarify this for me please. I'd really like to avoid having to reuse the same code over and over again directly in page templates.