<?php
/**
 * ACF configuration.
 *
 * Field groups are stored as local JSON in /acf-json (auto-loaded and syncable
 * from ACF > Field Groups). Keep that folder in version control.
 *
 * @package Genesis
 */

// Theme options page (fields live in acf-json/group_options.json).
add_action( 'acf/init', static function () {
    if ( function_exists( 'acf_add_options_page' ) ) {
        acf_add_options_page( [ 'page_title' => 'Options du thème' ] );
    }
} );

// Extra lightweight WYSIWYG toolbars, selectable per wysiwyg field.
add_filter( 'acf/fields/wysiwyg/toolbars', static function ( $toolbars ) {
    $toolbars['Simple']    = [ 1 => [ 'bold', 'italic', 'underline', 'link', 'bullist' ] ];
    $toolbars['Bold only'] = [ 1 => [ 'bold' ] ];
    return $toolbars;
} );

/*
 * Enqueue custom ACF admin scripts (example — drop your files in /js/admin):
 *
 * add_action( 'acf/input/admin_enqueue_scripts', function () {
 *     foreach ( [ 'my-admin-script' ] as $script ) {
 *         $path = get_template_directory() . '/js/admin/' . $script . '.js';
 *         if ( is_readable( $path ) ) {
 *             wp_enqueue_script( 'genesis-' . $script, get_template_directory_uri() . '/js/admin/' . $script . '.js', [ 'acf-input' ], (string) filemtime( $path ), true );
 *         }
 *     }
 * } );
 */
