PHP code example of agence-adeliom / acf-icon-picker

1. Go to this page and download the library: Download agence-adeliom/acf-icon-picker 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/ */

    

agence-adeliom / acf-icon-picker example snippets


"repositories": {
  ...
  "adeliom-icon-picker": {
      "type": "vcs",
      "url": "https://github.com/agence-adeliom/acf-icon-picker.git"
  },
  ...
}
...
"

use Adeliom\Acf\Fields\IconPicker;

...

IconPicker::make("Icône", "icon")->

acf_icon_picker([
    'name' => 'icon-picker',
    'label' => __('Icone', ''),
    '

// modify the path to the icons directory
add_filter( 'acf_icon_path_suffix', 'acf_icon_path_suffix' );

function acf_icon_path_suffix( $path_suffix ) {
    return 'assets/img/icons/';
}

// modify the path to the above prefix
add_filter( 'acf_icon_path', 'acf_icon_path' );

function acf_icon_path( $path_suffix ) {
    return plugin_dir_path( __FILE__ );
}

// modify the URL to the icons directory to display on the page
add_filter( 'acf_icon_url', 'acf_icon_url' );

function acf_icon_url( $path_suffix ) {
    return plugin_dir_url( __FILE__ );
}

// allowed to choose between Image or Font
add_filter( 'acf_icon_image', 'acf_icon_image' );
function acf_icon_image() {
    return true;
}

// modify the format (default : svg)
add_filter( 'acf_icon_image_format', 'acf_icon_image_format' );
function acf_icon_image_format() {
    return "png";
}

// modify the filename (fantasticon)
add_filter( 'acf_icon_filename', 'acf_icon_filename' );
function acf_icon_filename() {
    return "icons.scss";
}