Support

Account

Home Forums Add-ons Flexible Content Field Duplicate all flexible content into another flexible content

Unread

Duplicate all flexible content into another flexible content

  • Hi everyone,

    I made a page builder type thing using Flexible Content and a bunch of layouts within that flexible content.

    I know need to add a component that is itself a wrapper for other components, asides from cloning the flexible content field into the layout, is there any other way to do this?

    
    {{--
      Template Name: Page Builder
    --}}
    @extends('layouts.app')
    @section('content')
        <section class="page-blocks">
            {{-- 
                Loop through the layouts and render the appropriate blade file. 
                Note that our layouts use underscores and our Blade files use hyphens.
                E.g. layout news_block references news-block.blade.php.
            --}}
            @if (have_rows('page_blocks'))
                @while (have_rows('page_blocks'))
                    @php
                        the_row();
                        $layout = str_replace('_', '-', get_row_layout());
                    @endphp
    
                    @include('layouts.page-builder.' . $layout)
                @endwhile
            @endif
    
            {{-- @php
                $fields = get_fields();  
            @endphp
    
            <ul>
                @foreach ($fields as $name => $value)
                    <li><b>{{ $name }}</b> - {{ var_dump($value) }}</li>
                @endforeach
            </ul> --}}
        </section>
    @endsection
    

    Inside this loop I have a wrapper component that contains a clone of the parent

    
      <section class="multi-block-wrapper">
          {{-- 
                Loop through the layouts and render the appropriate blade file. 
                Note that our layouts use underscores and our Blade files use hyphens.
                E.g. layout news_block references news-block.blade.php.
            --}}
          @if (have_rows('inner_page_blocks'))
              @while (have_rows('inner_page_blocks'))
                  @php
                      the_row();
                      $layout = str_replace('_', '-', get_row_layout());
                  @endphp
    
                  @include('layouts.page-builder.' . $layout)
              @endwhile
    
          @endif
    
      </section>
    
    
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.