Am I doing something wrong? Looking to use widgetFor
to render a Markdown field inside of an object field contained in a list.
config.yml
...
collections:
- name: "pages"
label: "Pages"
label_singular: "Page"
folder: "content/blog"
create: true
fields:
- label: "Sections"
name: "sections"
widget: "list"
types:
- label: "Content Block"
name: "block_body"
widget: "object"
fields:
- label: "Image"
name: "image"
widget: "image"
- label: "Markdown"
name: "markdown"
widget: "markdown"
admin.html
widgetsFor('sections').map(function(section, index) {
console.log(section);
});
outputs (with Immutable formatting)
{"data" =>
{"image" => "/assets/brett-jordan-1329359-unsplash.jpg"}
{"markdown" => "# Title"}
{"type" => "block_body"}
}
{"widgets" => undefined}
But, when I use a standard list:
- label: "Sections"
name: "sections"
widget: "list"
fields:
- label: "Markdown"
name: "markdown"
widget: "markdown"
- label: "Image"
name: "image"
widget: "image"
admin.html
outputs
{"data" =>
{"image" => "/assets/brett-jordan-1329359-unsplash.jpg"}
{"markdown" => "# Title"}
{"type" => "block_body"}
}
{"widgets" =>
{"image" => Object}
{"markdown" => Object}
}