Usage of widgetFor inside widgetsFor possible? #78
-
Hello everyone, - name: "anmeldung-index"
label: "Anmeldung"
file: "content/german/anmeldung/_index.md"
fields:
- {label: "Titel", name: "title", widget: "string", required: true}
- {label: "Entwurf", name: "draft", widget: "boolean", default: "false", required: false}
- {label: "Hintergrundbild", name: "bg_image", widget: "hidden", default: "/media/backgrounds/page-title.png"}
- {label: "Bild", name: "image", widget: "image", default: "/media/image.png", required: false}
- {label: "Metabeschreibung", name: "description", widget: "text", required: false}
- label: "Elemente"
label_singular: "Element"
name: "elements"
widget: "list"
fields:
- {label: "Titel", name: "title", widget: "string", required: true}
- {label: "Text", name: "content", widget: "markdown", required: true}
required: false
- {label: "Text", name: "body", widget: "markdown", required: false} Everything is okay so far, but I don't understand how I can get the rendered markdown output from the content field inside elements. var AnmeldungPreviewContent = ({widgetsFor, widgetFor, entry}) => {
const divStyle = {
backgroundImage: 'url("/media/backgrounds/page-title.png"),url("/media/backgrounds/page-title.png")',
};
return h('div', {},
h('section', {"className": "page-title-section overlay", "style": divStyle},
h('div', {"className": "container"},
h('div', {"className": "col-md-8"},
h('ul', {"className": "list-inline custom-breadcrumb"},
h('li', {"className": "list-inline-item h2"},
h('a', {"className": "text-primary font-secondary", href: ""}, "Startseite")),
h('li', {"className": "list-inline-item h2"},
h("i", {"className": "fa-solid fa-angle-right text-white"})),
h('li', {"className": "list-inline-item text-white h2 font-secondary"}, entry.data.title)
),
h('p', {"className": "text-lighten"}, entry.data.description
)
)
)
),
h('section', {"className": "section-sm"},
h('div', {"className": "container"},
h('div', {"className": "row mb-5"},
h('div', {"className": "col-md-6 content"},
widgetFor('body')
)
),
h('div', {"className": "row"},
widgetsFor('elements').map(function(element, index) {
return h('div', {"className": "col-lg-4 col-sm-6 mb-4"},
h('div', {"className": "card rounded-0 hover-shadow border-top-0 border-left-0 border-right-0"},
h('div', {"className": "card-body"},
h('h4', {"className": "card-title mb-3"},
element.data.title
),
h('div', {"className": "content"},
element.widgets.content
)
)
)
);
})
)
)
),
);
}; Is there a way to use widgetFor inside the widgetsFor function? Every naming combination I tried so far didn't work...... Or is there another way to do that? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
After playing around with this, I this is definitely a bug. |
Beta Was this translation helpful? Give feedback.
After playing around with this, I this is definitely a bug.
widgetsFor
is supposed to callwidetFor
under the hood for each child field in a list or object. Right now its returning the right data, but not rendering the widgets properly.