HubL: How to set image field params on custom_widget
resolver
Let's say I have a custom module named "Test Module" defined with the following fields:
headline - text type field
body - text type field
url - text type field
image - image type field
I am inserting this module into my custom HTML template via the {% custom_widget %} HubL tag. I want to set some defaults, so I pass the paramaters into the custom_widget tag. Here is the code:
This works great, except I want to set the image as well. Now, I know I can set the default values in COS, but I want to set them at the template-level as this custom module will be used in different templates and the image will change. The problem is that it isn't clear how to set this, and I can't find any documentation about it anywhere.
Image fields appear to be dict type variables with the following properties:
src - image source URL
width - image width
height - image height
alt - image alternate text
Unfortunately the following code doesn't seem to work:
HubL: How to set image field params on custom_widget
resolver
...and moments later, I just figured it out!
Image paramaters are passed with underscores between the name of the image field (e.g. "image") and the name of the sub-property (e.g. "src", "width", etc). Here's what these parameters look like:
HubL: How to set image field params on custom_widget
resolver
...and moments later, I just figured it out!
Image paramaters are passed with underscores between the name of the image field (e.g. "image") and the name of the sub-property (e.g. "src", "width", etc). Here's what these parameters look like: