PHP code example of log1x / acf-editor-palette

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

    

log1x / acf-editor-palette example snippets


^ array:5 [▼
  "name" => "Green (500)"
  "slug" => "green-500"
  "color" => "#0e9f6e"
  "text" => "has-text-color has-green-500-color"
  "background" => "has-background has-green-500-background-color"
]

$field
  ->addField('my_color_field', 'editor_palette')
    ->setConfig('default_value', 'green-500')
    ->setConfig('allowed_colors', ['green-500', 'blue-500'])
    ->setConfig('exclude_colors', ['green-50', 'green-100'])
    ->setConfig('return_format', 'slug');