PHP code example of kmdigital / acf-block-builder

1. Go to this page and download the library: Download kmdigital/acf-block-builder library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kmdigital / acf-block-builder example snippets


use KMDigital\AcfBlockBuilder\Block;

$testimonial = new Block('testimonial');

$testimonial
    ->addWysiwyg('content')
    ->addText('person')
    ->addText('where')
    ->addText('when');

add_action('acf/init', function () use ($testimonial) {
    acf_add_local_field_group($testimonial->build());
});

$testimonial
  // Allows you to set a custom title for the block. 
  // Default is the block name/slug titlized.
  ->setTitle('Review')

  // Allows you to set the block description. Default is none.
  ->setDescription('A review with meta.')

  // Allows you to set the block description. Default is a block.
  ->setIcon('star-half')

  // Allows you to set the block category. Default is none.
  ->setCategory('common')

  // Allows you to set the block keywords. Default is none.
  ->setKeywords('review', 'testimonial')

  // Allows you to use a different rendering function. Default is Sage 10 (Acorn).
  ->renderWith(['Me\\View\\', 'render']);