Home › Forums › Add-ons › Flexible Content Field › 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>
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.