Support

Account

Home Forums Add-ons Repeater Field repeater field in gutenberg

Solved

repeater field in gutenberg

  • Hello, i am struggeling with the repeater field in a gutenberg field. Can some on give me advice of tell me what i am doing wrong? Or is this even possible?

    When i use @if(have_row() etc.. i am not getting the information i want. But i am receiving the information from a else statement.

    I am using sage10 en acf pro.

    blocks/content-sellingpoint.blade.php
    {{--
      Title: SellingPoint
      Description: Selling Points
      Category: formatting
      Icon: table-row-after
      Keywords: sellingpoint quote
      Mode: edit
      Align: left
      PostTypes: page post
      SupportsAlign: left right
      SupportsMode: false
      SupportsMultiple: false
      EnqueueStyle: styles/style.css
      EnqueueScript: scripts/script.js
      EnqueueAssets: path/to/asset
    --}}
    
    @php
      $title = get_sub_field('title');
      $subtext = get_sub_field('subtext');
      $sellingpoint = get_field('sellingpoint');
    
    @endphp
    
    <section class="sellingpoint">
      <div class="container">
        <div class="row">
          @if (have_rows('sellingpoint'))
            @while(have_rows('sellingpoint')) @php (the_row());
              {!! $subtext !!}
    
            @endwhile
    
          @else test
          @endif
        </div>
      </div>
    </section>
    functions.php
    add_action('acf/init', 'my_acf_init');
    function my_acf_init() {
    
    	// check function exists
    	if( function_exists('acf_register_block') ) {
    
        acf_register_block(array(
    			'name'				=> 'sellingpoint',
    			'title'				=> __('Sellingpoint'),
    			'description'		=> __('A custom sellingpoint block.'),
    			'render_callback'	=> 'my_acf_block_render_callback',
    			'category'			=> 'formatting',
    			'icon'				=> 'table-row-after',
    			'keywords'			=> array( 'Sellingpoint', 'selling', 'point' ),
    		));
    	}
    }
  • Hello, i am struggeling with the repeater field in a gutenberg field. Can some on give me advice of tell me what i am doing wrong? Or is this even possible?

    When i use @if(have_row() etc.. i am not getting the information i want. But i am receiving the information from a else statement.

    I am using sage10 en acf pro.

    blocks/content-sellingpoint.blade.php
    {{--
      Title: SellingPoint
      Description: Selling Points
      Category: formatting
      Icon: table-row-after
      Keywords: sellingpoint quote
      Mode: edit
      Align: left
      PostTypes: page post
      SupportsAlign: left right
      SupportsMode: false
      SupportsMultiple: false
      EnqueueStyle: styles/style.css
      EnqueueScript: scripts/script.js
      EnqueueAssets: path/to/asset
    --}}
    
    @php
      $title = get_sub_field('title');
      $subtext = get_sub_field('subtext');
      $sellingpoint = get_field('sellingpoint');
    
    @endphp
    
    <section class="sellingpoint">
      <div class="container">
        <div class="row">
          @if (have_rows('sellingpoint'))
            @while(have_rows('sellingpoint')) @php (the_row());
              {!! $subtext !!}
    
            @endwhile
    
          @else test
          @endif
        </div>
      </div>
    </section>
    functions.php
    add_action('acf/init', 'my_acf_init');
    function my_acf_init() {
    
    	// check function exists
    	if( function_exists('acf_register_block') ) {
    
        acf_register_block(array(
    			'name'				=> 'sellingpoint',
    			'title'				=> __('Sellingpoint'),
    			'description'		=> __('A custom sellingpoint block.'),
    			'render_callback'	=> 'my_acf_block_render_callback',
    			'category'			=> 'formatting',
    			'icon'				=> 'table-row-after',
    			'keywords'			=> array( 'Sellingpoint', 'selling', 'point' ),
    		));
    	}
    }
  • i solved by accident mine question. But it isn’t, is it possible to switch it back?

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.