HubSpot Ideas

jmclaren

Create a path to make it possible to migrate existing fields to be style fields

With the release of the style field functionality existing modules which may have been using content fields as styling fields currently do not have a path to migrate to the new style fields because existing saved data will not map to new fields within a separate field group (the Styles group).

Please upvote this issue if you feel this is a necessary update for your team. This will affect the prioritization by the team working on the style fields functionality.

 

To be clear - existing themes and modules CAN ADD style fields. The issue is specifically that there is currently no migration path for data saved to content fields in pages, to be mapped to a style field instead.

 

Because of this we strongly advise marketplace providers to not replace existing fields in modules with style fields, but to only add new style fields or create a new listing for your asset. This will prevent your changes from being breaking for existing users.

 

 

Atualizações da HubSpot
Status atualizado para: Delivered
May 10, 2023 09:02 AM

To ensure that template-level default values are properly passed to the correct fields, we've added a new feature to custom modules called aliases. These are basically fake "system names" that if you were to use them when calling a custom module within a template, will result in the correct field getting the value.

 

Alias mapping enables you to create field mappings in a module so that you can move, rename, or replace its fields without impacting pages that are using the module. 

For example, a module is being used on a live page. You want to move some fields into the Styles tab, such as color or font, but a content creator has already selected values for those fields in the editor. If you were to move those fields without setting up alias mapping, HubSpot would not be able to relocate those fields and they would revert to their default values, which would undo the styling on the live page.

Instead, you can add an aliases_mapping property to a field to map it to another one. Then, when a value has not been set for the original field, HubSpot will check if a value exists in the mapped field. If no value exists in the mapped field either, it will use the default value instead. This property can be used to map field values between different versions of a module only when the stored data type of the old field is the same as the new field's stored data type.

For a visual walkthrough of this feature, check out the video below.




For implementation instructions see this developer doc: https://developers.hubspot.com/docs/cms/marketplace-guidelines/module-requirements#aliases

1 Comentário
Status atualizado para: Delivered
mbrosofsky
Equipe de Produto da HubSpot

To ensure that template-level default values are properly passed to the correct fields, we've added a new feature to custom modules called aliases. These are basically fake "system names" that if you were to use them when calling a custom module within a template, will result in the correct field getting the value.

 

Alias mapping enables you to create field mappings in a module so that you can move, rename, or replace its fields without impacting pages that are using the module. 

For example, a module is being used on a live page. You want to move some fields into the Styles tab, such as color or font, but a content creator has already selected values for those fields in the editor. If you were to move those fields without setting up alias mapping, HubSpot would not be able to relocate those fields and they would revert to their default values, which would undo the styling on the live page.

Instead, you can add an aliases_mapping property to a field to map it to another one. Then, when a value has not been set for the original field, HubSpot will check if a value exists in the mapped field. If no value exists in the mapped field either, it will use the default value instead. This property can be used to map field values between different versions of a module only when the stored data type of the old field is the same as the new field's stored data type.

For a visual walkthrough of this feature, check out the video below.




For implementation instructions see this developer doc: https://developers.hubspot.com/docs/cms/marketplace-guidelines/module-requirements#aliases