<?php
if (function_exists('acf_add_options_page')) {
    $parent = acf_add_options_page(array(
        'page_title' => 'Options du thème',
        'menu_title' => 'Options du thème',
        'menu_slug' => 'theme-general-settings',
        'capability' => 'edit_posts',
        'position' => 1,
        'redirect' => true
    ));

    acf_add_options_sub_page(array(
        'page_title' => 'Informations de contact',
        'menu_title' => 'Informations de contact',
        'parent_slug' => $parent['menu_slug'],
        'menu_slug' => 'theme-options-contact'
    ));

    acf_add_options_sub_page(array(
        'page_title' => 'Menus',
        'menu_title' => 'Menus (topbar, legals..)',
        'parent_slug' => $parent['menu_slug'],
        'menu_slug' => 'theme-options-menus'
    ));

    acf_add_options_sub_page(array(
        'page_title' => 'Dictionnaire',
        'menu_title' => 'Dictionnaire',
        'parent_slug' => $parent['menu_slug'],
        'menu_slug' => 'theme-options-dico'
    ));
    acf_add_options_sub_page(array(
        'page_title' => 'Affectation des pages',
        'menu_title' => 'Affectation des pages',
        'parent_slug' => $parent['menu_slug'],
        'menu_slug' => 'theme-options-pages'
    ));
    acf_add_options_sub_page(array(
        'page_title' => 'Médias',
        'menu_title' => 'Médias',
        'parent_slug' => $parent['menu_slug'],
        'menu_slug' => 'theme-options-media'
    ));
}

// Include ACF field groups
require_once get_template_directory() . '/inc/acf/option-contact-information.php';
require_once get_template_directory() . '/inc/acf/option-menus.php';
require_once get_template_directory() . '/inc/acf/pages-assignment.php';
require_once get_template_directory() . '/inc/acf/icons.php';
require_once get_template_directory() . '/inc/acf/homepage.php';
require_once get_template_directory() . '/inc/acf/option-dico.php';
require_once get_template_directory() . '/inc/acf/option-media.php';
