Roots Discourse

ACF Pro Clone Sage 9 - new to all of this, trying to understand

I am totally new to WP, ACF Pro and clone. I am new to Sage 9, as well, but I have worked with Laravel, which makes Sage somewhat familiar to me.

My boss has told me that I have to use “Clone” within an ACF thing that I have created, because he wants me to reuse the flexible content that he has already created, which makes sense to me. The following is a screen shot:

The following is the code from my blade, where I am trying to retrieve the wysiwyg editor that I have within my “mission” page:

@extends('layouts.app')

@section('content')
  @php $all_flex_fields_mission = get_field('all-flex-fields-mission'); @endphp
  @if ($all_flex_fields_mission)
    @dump($all_flex_fields_mission)
    @php $wysiwyg = get_sub_field('wysiwyg') @endphp
    @if($wysiwyg)
      @while(have_rows('wysiwyg')) @php(the_row())
      {!! $wysiwyg !!}
      @endwhile
    @endif
  @endif
@endsection

I was not having the simple “test” within the wysiwyg returned, so I did a @dump to see what was returning:

array(1) { [0]=> array(2) { ["acf_fc_layout"]=> string(30) "all-flex-fields-mission-layout" ["wysiwyg"]=> string(12) "

test

" } }

The wysiwyg is there in the array produced from the get_field - how do I have show up in the blade?

This is not a Sage issue but it looks like you are passing the wrong field name to get_sub_field.

Try replacing get_sub_field('wysiwyg') with get_sub_field('mission_wysiwyg')

Thanks for replying but I am still not seeing the field show up

have_rows('wysiwyg') should be have_rows('all-flex-fields-mission-layout')

I’m sure you already checked this out, but I think the documentation for ACF Flexible Content will help clarify this. Carefully compare the field names in their screenshot of the settings page to the examples.

Thank you so much for your replies.

I have tried the following, but it still does display the wysiwyg:

    @extends('layouts.app')

@section('content')

  @if (have_rows('all-flex-fields-mission-layout'))
    @if (get_row_layout() == 'paragraph')
      @php $wysiwyg = get_sub_field('mission-wysiwyg'); @endphp
      {!! $wysiwyg !!}
    @endif
  @endif
@endsection

    @extends('layouts.app')

@section('content')

  @if (have_rows('all-flex-fields-mission-layout'))
    @php $wysiwyg = get_sub_field('mission-wysiwyg'); @endphp
    @while(have_rows('all-flex-fields-mission-layout')) @php(the_row())
      {!! $wysiwyg !!}
    @endwhile
  @endif
@endsection

    @extends('layouts.app')

@section('content')

  @if (have_rows('all-flex-fields-mission-layout'))
    @if (get_row_layout() == 'paragraph')
      @php $wysiwyg = get_sub_field('mission-wysiwyg'); @endphp
      @while(have_rows('all-flex-fields-mission-layout')) @php(the_row())
        {!! $wysiwyg !!}
      @endwhile
    @endif
  @endif
@endsection

Maybe this has something to do with why it is not showing up. In the page “Mission,” the wysiwyg is showing up as the clone’s original name “Basic” - do you think that has to do with why “mission-wysiwyg” is not showing up? Please see the following screen shot

This topic was automatically closed after 42 days. New replies are no longer allowed.