CMS Development

BarryGrennan
Top Contributor

Issue setting Image as repeater field (bug?)

SOLVE

The last day or so I've noticed an issue in module creation.

 

To make sure it was happening I created the most basic module possible that would still exhibit the behaviour:  A module with a single input for an Image, set to a repeater field and the default object count set (set to 5 in my test but this is arbitrary).

 

The html for the default objects is created as expected, but the objects aren't listed in the modules edit section. Instead it says "No Image yet. Add one."

 

Anyone else experiencing this?

 

I'm not sure if it's only happening with image inputs, the only other input I've tested ws text and it's not occurring there.

Repeater Issue 1.pngRepeater Issue 2.png

 


profile2022aBarry Grennan

Freelance HubSpot CMS Developer

Website | Contact | LinkedIn

 

 

0 Upvotes
2 Accepted solutions
alyssamwilie
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Issue setting Image as repeater field (bug?)

SOLVE

Yea, I've seen this occur quite frequently, and not just with image fields. 

If this answer solved your question, please mark it as the solution.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.

View solution in original post

BarryGrennan
Solution
Top Contributor

Issue setting Image as repeater field (bug?)

SOLVE

@alyssamwilie glad I'm not the only one! Thought I was losing my mind yesterday!

 

My current workaround is creating a field group containing an image and a text input. Setting the text input to "prevent editing in content editors" and then making the field group the repeater. It seems to resolve it, but it's definitely not how it should work.

 


profile2022aBarry Grennan

Freelance HubSpot CMS Developer

Website | Contact | LinkedIn

 

 

View solution in original post

0 Upvotes
3 Replies 3
_aureliocampos
Participant

Issue setting Image as repeater field (bug?)

SOLVE

Hi @BarryGrennan , how are you?

As I understand it, Hubspot is taking your image and replicating it 5 times, so that you have the expected result, you must access your module's fields.json files and register the urls and texts of your 5 items there.

 

Note: You need a local development environment

 

  • Step 1
    You access the fields.json file and search for the name of your repeater field.
  • Step 2
    Then you go to the "default" property, which should be an array.
  • Step 3
    You add your content with the names of the variables created in object format, as for the images you can get their urls from the hubspot files and add to your field.

 

"name": "repeater_field_name",
...
"default" : [ {
    "title" : "first item default title",
    "text" : "first item default text",
    "icon" : {
      "src" : "https://yourwebsite.com/hubfs/icon.png",
      "alt" : "Icon",
      "width" : 32,
      "height" : 32,
      "max_width" : 32,
      "max_height" : 32,
      "loading" : "lazy"
    }
  },
 {
    "title" : "second item default title",
    "text" : "second item default text",
    "icon" : {
      "src" : "https://yourwebsite.com/hubfs/icon.png",
      "alt" : "Icon",
      "width" : 32,
      "height" : 32,
      "max_width" : 32,
      "max_height" : 32,
      "loading" : "lazy"
    }
  },
...
]


 hope this helps!

0 Upvotes
alyssamwilie
Solution
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Issue setting Image as repeater field (bug?)

SOLVE

Yea, I've seen this occur quite frequently, and not just with image fields. 

If this answer solved your question, please mark it as the solution.

Alyssa Wilie Profile Image

Alyssa Wilie

Web Developerat Lynton

Learn HubL | Get Marketing Insights

HubSpot Elite Solutions Partner
Lynton's HubSpot theme Rubric now available. Click to download.
BarryGrennan
Solution
Top Contributor

Issue setting Image as repeater field (bug?)

SOLVE

@alyssamwilie glad I'm not the only one! Thought I was losing my mind yesterday!

 

My current workaround is creating a field group containing an image and a text input. Setting the text input to "prevent editing in content editors" and then making the field group the repeater. It seems to resolve it, but it's definitely not how it should work.

 


profile2022aBarry Grennan

Freelance HubSpot CMS Developer

Website | Contact | LinkedIn

 

 

0 Upvotes