Struggling with a nested grid

I am struggling big time :confused:. I tried the columns blocks plugin but dont get the result that I want.

I am looking for a way to get this output:

<section>
  <div class="container">
    <div class="grid">
      <div class="row">
        <div class="col-12">
          <h1>Some blocks</h1>
        </div>

        <div class="col-6">
          <h1>Some blocks</h1>
        </div>

        <div class="col-6">
          <h1>Another grid</h1>
          <div class="grid">
            <div class="row">

              <div class="col-6">
                <h1>Some blocks</h1>
              </div>

              <div class="col-6">
                <h1>Some blocks</h1>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
</section>

So in the panel, you add a section, then inside a grid layout (only 1 per section) with columns inside. And then inside a column you can add some blocks and another grid. I don’t want infinite grids but just 1 inside where I can add new blocks

This should be possible without any plugin right?
Can someone help me out and give me a example of the blueprints structures I would need.

Big thanx in advance. :heart:

Something like this should work:

          mainlayout:
            label: Default blocks
            type: layout
            layouts:
              - "1/1"
              - "1/2, 1/2"
            fieldsets:
              nestedlayout:
                preview: fields
                wysiwyg: true
                fields:
                  nestedlayout:
                    type: layout
                    layouts:
                      - "1/1"
                      - "1/2, 1/2"

I am trying it. It works in the panel:

columns:
  main:
    width: 2/3
    sections:
      content:
        type: fields
        fields:
          mainlayout:
            label: Default blocks
            type: layout
            layouts:
              - "1/1"
              - "1/2, 1/2"
            fieldsets:
              - heading
              - text
              - image
              - nestedlayout
              # Add more block types as needed
              nestedlayout:
                preview: fields
                wysiwyg: true
                fields:
                  nestedlayout:
                    type: layout
                    layouts:
                      - "1/1"
                      - "1/2, 1/2"

But struggeling with the php

<section>
  <div class="container">
    <?php if ($mainGrid = $page->mainlayout()->toLayouts()): ?>
      <?php foreach ($mainGrid as $layout): ?>
        <div class="grid">
          <div class="row">
            <?php foreach ($layout->columns() as $column): ?>
              <div class="col-<?= $column->span() ?>">
                <?php foreach ($column->blocks() as $block): ?>
                  <?php if ($block->type() === 'nestedlayout'): ?>
                    <div class="grid">
                      <h1>Nested Layout</h1>
                      <div class="row">
                        <?php foreach ($block->toLayouts() as $nestedLayout): ?>
                          <?php foreach ($nestedLayout->columns() as $nestedColumn): ?>
                            <div class="col-<?= $nestedColumn->span() ?>">
                              <?php foreach ($nestedColumn->blocks() as $nestedBlock): ?>
                                <?= $nestedBlock->toHtml() ?>
                              <?php endforeach; ?>
                            </div>
                          <?php endforeach; ?>
                        <?php endforeach; ?>
                      </div>
                    </div>
                  <?php else: ?>
                    <?= $block->toHtml() ?>
                  <?php endif; ?>
                <?php endforeach; ?>
              </div>
            <?php endforeach; ?>
          </div>
        </div>
      <?php endforeach; ?>
    <?php endif; ?>
  </div>
</section>

Getting an error; Call to a member function columns() on null

Can you help me with the PHP?

It should be $block->nestedlayout()->toLayouts() as $nestedLayout

Thanx so much you are a boss