Maximum function nesting level of '256' reached, aborting! while using nested builders

Hi,
It’s me again.

I’m using the plugin Kirby Builder with nested builders on a page. (I work on Kirby 3.4.2)

Here is my blueprint:

     - width: 2/3
        fields:
          sectionBuilder:
            label: Services / Formations
            type: builder
            columns: 1
            max: 3
            fieldsets:
              content:
                name: Service / Formation
                fields:
                  contentName:
                    name: Nom
                    label: Nom du service / de la formation
                    type: text
                  contentIcon:
                    name: Icône
                    label: Icône du service / de la formation
                    type: text
                  contentBuilder:
                    name: Contenu
                    type: builder
                    max: 2
                    fieldsets:
                      argumentright:
                        name: Présentation - Image à droite
                        preview:
                          snippet: blocks/argumentright
                          css: /avocatms.fr/assets/css/blocks/argumentright.css
                        defaultView: preview
                        fields:
                          argumentrighttext:
                            label: Texte
                            type: textarea
                            buttons: 
                              - bold
                              - italic
                              - '|'
                              - link
                              - '|'
                              - ol
                              - ul
                          argumentrightimage:
                            label: Image
                            type: files
                            multiple: false
                      argumentleft:
                        name: Présentation - Image à gauche
                        preview:
                          snippet: blocks/argumentleft
                          css: /avocatms.fr/assets/css/blocks/argumentleft.css
                        defaultView: preview
                        fields:
                          argumentlefttext:
                            label: Texte
                            type: textarea
                            buttons: 
                              - bold
                              - italic
                              - '|'
                              - link
                              - '|'
                              - ol
                              - ul
                          argumentleftimage:
                            label: Image
                            type: files
                            multiple: false
                      argumenttextonly:
                        name: Présentation - Aucune image
                        preview:
                          snippet: blocks/argumenttextonly
                          css: /avocatms.fr/assets/css/blocks/argumenttextonly.css
                        defaultView: preview
                        fields:
                          argumenttextonlytext:
                            label: Texte
                            type: textarea
                            buttons: 
                              - bold
                              - italic
                              - '|'
                              - link
                              - '|'
                              - ol
                              - ul

I can set my content easily, but I got the error Maximum function nesting level of ‘256’ reached, aborting! with my templates.

I got multiple templates/snippets:

  1. The page where i’m calling the first builder
         ...
        <section class="about py-80" id="about">
                <div class="container">
                    <div class="row">
                        <div class="offset-md-2 col-lg-8">
                            <div class="intro-box">
                                <?= $page->intro()->kt() ?>
                            </div>
                        </div>
                    </div>
                    <?php
                    foreach($page->sectionbuilder()->toBuilderBlocks() as $block):
                    snippet('blocks/' . $block->_key(), array('data' => $block));
                    endforeach;
                    ?>
                    
                </div>
            </section>
           ...
  1. The first snippet where I’m calling the 2nd builder
    <section class="services py-100-70">
       <div class="container">
         <div class="row">
             <div class="col-md-8 offset-md-2">
                 <div class="sec-title text-center">
                     <h1>
                         <i class="fal fa-<?= $data->contenticon() ?>"></i>
                     </h1>
                     <h2>
                         <?= $data->contentname() ?>
                     </h2>
                 </div>
             </div>
         </div>
     </div>

     <?php
     foreach($page->sectionbuilder()->contentbuilder()->toBuilderBlocks() as $block):
     snippet('blocks/' . $block->_key(), array('data' => $block));
     endforeach;
     ?>
    </section>
  1. And then my snippets for my blocks (they are working)

I’m not sure how to fix this, I think it’s creating an endless loop but I have only three blocks on my first builder and two on my second builder.

Thanks

EDIT: i can’t paste the third code, here is a pastebin https://pastebin.com/cRXcXf1P

The problem is that you are starting at $page and the sectionbuilder field again. But you have to use your $data variable inside the snippet:

 <?= $data->contentname() ?>
<?php foreach($data->contentbuilder()->toBuilderBlocks() as $block): 
snippet('blocks/' . $block->_key(), array('data' => $block)); 
endforeach; ?> 

Please use three backticks on a separate line before and after a codeblock to make your code readable and to enable code highlighting. Thank you.

Thank you very much it’s working!

(I can’t do backticks with my f** french keyboard)

What’s your OS? I’m pretty sure there is a way.