<p>I'm not familiar with ACF, but if you're looking for blocks-within-blocks, you could use the <a href="https://github.com/benjamminf/craft-neo" rel="noreferrer">Neo plugin/fieldType</a>. It allows you to define blocks, and then have nested blocks. It allows for decent management of blocks, too, so that you have children of specific parents. </p>

<p>For example:
You could have the following blocks/content types:  </p>

<ul>
<li>Copy</li>
<li>Card</li>
<li>Image slider</li>
<li>Form</li>
<li>Ad Unit</li>
<li>Related Content</li>
</ul>

<p>And then the following layouts and components:  </p>

<ul>
<li>Two-column</li>
<li>Three-column</li>
<li>Single column w/ Sidebar</li>
<li>Column</li>
<li>Sidebar</li>
</ul>

<p>The Neo fieldType would allow you to make block groups, and then allow the content blocks to be limited to certain layout blocks. It would look like this (demo only, not fully configured):</p>

<p>The <code>layouts</code> are selectable at the top level. You need these to target template files (or at least it makes it easier, IMHO).  </p>

<p><a href="https://i.sstatic.net/cpUdB.jpg" rel="noreferrer"><img src="https://i.sstatic.net/cpUdB.jpg" alt="enter image description here"></a></p>

<p>The layouts can only have <code>columns</code> or <code>sidebars</code>. The two- and three-column only have columns, while the single has column and sidebar.  </p>

<blockquote>
  <p><strong>Note:</strong> Currently blocks are only limited on the page level and not the block level, meaning if you set the max number of <code>columns</code> to 1, you'll only be allowed one column per entry.  </p>
</blockquote>

<p><a href="https://i.sstatic.net/cE07N.jpg" rel="noreferrer"><img src="https://i.sstatic.net/cE07N.jpg" alt="enter image description here"></a></p>

<p>The <code>column</code> block has the main content types, while the <code>sidebar</code> block has the sidebar content types.  </p>

<p><a href="https://i.sstatic.net/Aincx.jpg" rel="noreferrer"><img src="https://i.sstatic.net/Aincx.jpg" alt="enter image description here"></a></p>

CC BY-SA 3.0
2018-01-16T00:14:09.040Z
Thanks Ian DeRanieri. A very useful explanation of using Neo for this sort of 'templated layout'.

My only question is, considering you can't limit the amount of column blocks in one of your layout blocks, did you end up just relying on the user to only add the appropriate number of column blocks to each layout block, or did you use some CP JavaScript to achieve it?
Tim Everts
CC BY-SA 3.0
2016-07-15T22:38:30.130Z
2016-07-15T22:38:30.130Z
Ian DeRanieri
<p>A little background first; I'm coming from WordPress, along with the Advanced custom fields (ACF) plugin, so my thinking behind this may not be the best way in Craft. </p>

<p>In ACF I usually set up a field set that consists of an outer repeater field, with a nested flexible content field inside (much like the Matrix field in Craft). Within the repeat field, there are a couple of options that controls the appearance of a section, such as a background colour/image. This is also used in my template to differentiate where a <code>&lt;section&gt;</code> starts and ends, and often has styles associated to style the overall section. Anything within the flexible content fields is contained within this.</p>

<p>Then, within the flexible content field, I define my layout types (title block, two column text, text with image, etc.). An image to describe the layout structure if my description is a little confusing: <img src="https://i.sstatic.net/ZVnCa.jpg" alt="Sections"></p>

<p>I'm looking to create a similar sort of set up with Craft. Without an outer repeater field, I'm struggling to think how to achieve the "section" container. What would be a way to achieve this sort of thing?</p>

<p>Thanks!</p>

CC BY-SA 3.0
2015-03-05T09:53:46.390Z
Hmmm - thats a tricky one. All I can think of is to have a block called 'section', which in your templates, you use to create your opening and closing tags. Right now, there's no matrix-in-matrix, which I think is what you're after, if you're looking to replicate ACF.
crawf
CC BY-SA 3.0
2015-03-05T10:52:29.380Z
This looks to be the route I need to go down. I may need to use a "section start" and a "section end" to simplify logic as much as possible. A little more work for the client, but with a little training it should make sense.
Mark Goodyear
CC BY-SA 3.0
2015-03-05T11:01:48.297Z
This related answer from Brandon might help you avoid needing the start + end blocks http://craftcms.stackexchange.com/a/6739
Jamie Pittock
<matrix><sections><best-practice><content><contentmodel>
Modelling flexible content sections and recommendations
# Modelling flexible content sections and recommendations

(Asked by: username_0 on 2015-03-04)

A little background first; I'm coming from WordPress, along with the Advanced custom fields (ACF) plugin, so my thinking behind this may not be the best way in Craft.

In ACF I usually set up a field set that consists of an outer repeater field, with a nested flexible content field inside (much like the Matrix field in Craft). Within the repeat field, there are a couple of options that controls the appearance of a section, such as a background colour/image. This is also used in my template to differentiate where a  starts and ends, and often has styles associated to style the overall section. Anything within the flexible content fields is contained within this.

Then, within the flexible content field, I define my layout types (title block, two column text, text with image, etc.). An image to describe the layout structure if my description is a little confusing: ![Sections](https://i.sstatic.net/ZVnCa.jpg)

I'm looking to create a similar sort of set up with Craft. Without an outer repeater field, I'm struggling to think how to achieve the "section" container. What would be a way to achieve this sort of thing?

Thanks!

**Tags:** matrix, sections, best-practice, content, contentmodel

> **Comments:**
> **username_1**: Hmmm - thats a tricky one. All I can think of is to have a block called 'section', which in your templates, you use to create your opening and closing tags. Right now, there's no matrix-in-matrix, which I think is what you're after, if you're looking to replicate ACF.  
> **username_0**: This looks to be the route I need to go down. I may need to use a "section start" and a "section end" to simplify logic as much as possible. A little more work for the client, but with a little training it should make sense.  
> **username_2**: This related answer from Brandon might help you avoid needing the start + end blocks http://craftcms.stackexchange.com/a/6739  

---

## 1 answers

### Answer by username_3 on 2016-07-15. Score: 6

I'm not familiar with ACF, but if you're looking for blocks-within-blocks, you could use the [Neo plugin/fieldType](https://github.com/benjamminf/craft-neo). It allows you to define blocks, and then have nested blocks. It allows for decent management of blocks, too, so that you have children of specific parents.

For example:
You could have the following blocks/content types:

* Copy
* Card
* Image slider
* Form
* Ad Unit
* Related Content

And then the following layouts and components:

* Two-column
* Three-column
* Single column w/ Sidebar
* Column
* Sidebar

The Neo fieldType would allow you to make block groups, and then allow the content blocks to be limited to certain layout blocks. It would look like this (demo only, not fully configured):

The `layouts` are selectable at the top level. You need these to target template files (or at least it makes it easier, IMHO).

[![enter image description here](https://i.sstatic.net/cpUdB.jpg)](https://i.sstatic.net/cpUdB.jpg)

The layouts can only have `columns` or `sidebars`. The two- and three-column only have columns, while the single has column and sidebar.

> **Note:** Currently blocks are only limited on the page level and not the block level, meaning if you set the max number of `columns` to 1, you'll only be allowed one column per entry.

[![enter image description here](https://i.sstatic.net/cE07N.jpg)](https://i.sstatic.net/cE07N.jpg)

The `column` block has the main content types, while the `sidebar` block has the sidebar content types.

[![enter image description here](https://i.sstatic.net/Aincx.jpg)](https://i.sstatic.net/Aincx.jpg)

> **Comments:**
> **username_4**: Thanks username_3. A very useful explanation of using Neo for this sort of 'templated layout'.  My only question is, considering you can't limit the amount of column blocks in one of your layout blocks, did you end up just relying on the user to only add the appropriate number of column blocks to each layout block, or did you use some CP JavaScript to achieve it?  

---

