PHP code example of pxlrbt / acf-configurator

1. Go to this page and download the library: Download pxlrbt/acf-configurator 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/ */

    

pxlrbt / acf-configurator example snippets




use pxlrbt\AcfConfigurator\FieldGroup;
use pxlrbt\AcfConfigurator\Condition\Condition;
use pxlrbt\AcfConfigurator\Location\Location;
use pxlrbt\AcfConfigurator\Fields\Email;
use pxlrbt\AcfConfigurator\Fields\Text;
use pxlrbt\AcfConfigurator\Fields\TrueFalse;
use pxlrbt\AcfConfigurator\Fields\Repeater;
use pxlrbt\AcfConfigurator\Fields\Image;

FieldGroup::make('Test group', 'test')
    ->location(function($condition) {
        $condition->if(Location::$PARAM_POST_TEMPLATE, Location::$OPERATOR_EQUALS, 'template.php')
            ->andIf(Location::$PARAM_POST_TYPE, Location::$OPERATOR_EQUALS, 'page');
    })
    ->fields([
        Text::make('Text field', 'text')
            ->placeholder('Placeholder')
            ->