I try to create a modular theme with repeater fields and groups. So i create a block.yaml with my group of fields:
carousel:
name: Carousel
description: Carousel
icon: icon-file-image-o
fields:
section_carouselimage:
label: Image
type: mediafinder
mode: image
section_carouseltitle:
label: Title
type: text
section_carouselsubtitle:
label: Subtitle
type: textarea
size: small
services1:
name: Services1
description: Title with Description
icon: icon-cog
fields:
section_services1icon:
label: Icon
type: text
section_services1title:
label: Title
type: text
section_services1subtitle:
label: Subtitle
type: textarea
size: small
, i also create a repeater on layout tha calls this group of fields:
<!-- repeater definition -->
{repeater name="sections" groups="themes/mytheme/meta/blocks.yaml" tab="Blocks" prompt="Add new item" }
{variable name="_dummy" type="text"}{/variable}
{/repeater}
Everything is working fine and i can render all my fields. Now if i add a group with a repeater in block.yaml like this:
carousel2:
name: Carousel2
description: Carousel2
icon: icon-file-image-o
fields:
section_carousel2:
type: repeater
prompt: Add new subitem
form:
fields:
section_carouselimage2:
label: Image2
type: mediafinder
mode: image
section_carouseltitle2:
label: Title2
type: text
section_carouselsubtitle2:
label: Subtitle2
type: textarea
size: small
is working fine on my backend and i can save my fields in index.htm as you can see:
[viewBag]
title = "Home"
url = "/"
layout = "static"
is_hidden = 0
navigation_hidden = 0
sections[0][section_carousel2][1][section_carouselimage2] = "/carousel/bg-1.jpg"
sections[0][section_carousel2][1][section_carouseltitle2] = "Carousel2 Title"
sections[0][section_carousel2][1][section_carouselsubtitle2] = "Carousel2 Subitle"
sections[0][section_carousel2][2][section_carouselimage2] = "/carousel/bg-2.jpg"
sections[0][section_carousel2][2][section_carouseltitle2] = "Carousel2 Title2"
sections[0][section_carousel2][2][section_carouselsubtitle2] = "Carousel2 Subtitle2"
sections[0][_group] = "carousel2"
==
The problem is that i can't find a way to render those fields from repeater. How can i render section_carouselimage2 in my partial for example? What loop to use to render the field from repeater? I really need help here, thanks!
Last updated