List type fieldsets are used when you want to store multiple entries of your grouped fields. Think of them as an array of objects, like an array LIST
type fieldsets can have multiple objects in it.
You can add any number of fields inside a field-set. LIST
type is set by default when your create a field-set.
Minimum one field is required to create a
LIST
type field-set.
For example, for a Contact Us Page in a wesbite, you want to fetch FAQ’s that needs to be listed there, instead of creating a table, you can create a LIST
type field set, that can contain multiple entries.
In the Graph
Create a List field-set by simply creating a field-set and marking the input type as LIST
.
In the CMS
When you publish a LIST
type fieldset, it's available in the Content Management System as a form input and you can add any number of them.
In the API
In the API the output for a list type field-set is an array of objects with the fields inside them as the keys.
Sample GraphQL Request
query {
contactUsPages {
title
faQs { # Marked as a list type field-set
question
answer
}
}
}
Sample GraphQL Response
{
"data": {
"contactUsPages": [
{
"title": "Pricing",
"faQs": [
{
"question": "How many users can be invited to a project?",
"answer": "You can invite any number of user's to a project but will be charged $5 per extra user"
},
{
"question": "How many API calls is allowed?",
"answer": "The API Calls limit is mentioned in the billing page of your account according to the plan you are subscr"
}
]
}
]
}
}
Think of
LIST
type as anArray
which can store multiple items.