Reputation: 51
Trying to utilize Collection Types + Component to create row splits.
Rough idea
Collection type has a name and 2 dynamic zones - left and right.
In this example the name is set to "example-split"
Page Collection-Type has a Dynamic zone where you can put the Split Component and add relation to the Split Collection-type (that has left and right blocks filled with components).
Component has its metadata, like is it 1-2 or 1-1, etc.
This essentially creates a base for dynamically split components.
Problem
The problem is that I get block data, I get which layout type it is, but it does not include the components inside related Collection Type.
I get my blocks with this query:
/api/pages?filters[slug][$eq]=${slug}&populate[blocks][populate]=*&populate[SEO]=*
slug is dynamic page, and populates the page with blocks (and their media or components) and SEO collection type.
I tried different combinations to try and acquire components inside splits, for example
/api/pages?filters[slug][$eq]=${slug}&populate[blocks][populate]=*&populate[SEO]=*&populate[blocks][row-split][splits]=*
and
/api/pages?filters[slug][$eq]=${slug}&populate[blocks][populate]=*&populate[SEO]=*&populate[blocks][splits.leftBlock]=*
and other variations from the official guide, but it doesn't quite seem to work the way I want it to.
Is it architecturally impossible to achieve like this, or is the query incorrect?
Edit 1 Screenshot of Split Collection Type
That finalizes everything there is related to splits
Upvotes: 0
Views: 104
Reputation: 51
There is a Populate Deep plugin that does the job. In fact, in makes query much simpler. However it does not work when trying to combine queries, like in my case, but hopefully it will be future-proof and fetch everything that might be needed.
Query now:
/api/pages?filters[slug][$eq]=${slug}&populate=deep
Upvotes: 0