<?php
if (function_exists('acf_add_local_field_group')):
    acf_add_local_field_group(array(
        'key' => 'group_contact_information',
        'title' => 'Informations de contact',
        'fields' => array(
            array(
                'key' => 'field_address',
                'label' => 'Adresse',
                'name' => 'address',
                'type' => 'textarea',
                'required' => 1,
                'new_lines' => 'br'
            ),
            array(
                'key' => 'field_opening_hours',
                'label' => 'Horaires d\'accueil',
                'name' => 'opening_hours',
                'type' => 'textarea',
                'required' => 1,
                'new_lines' => 'br'
            ),
            array(
                'key' => 'field_phone',
                'label' => 'Téléphone',
                'name' => 'phone',
                'type' => 'text',
                'required' => 1
            ),
            array(
                'key' => 'field_email',
                'label' => 'Email',
                'name' => 'email',
                'type' => 'email',
                'required' => 1
            ),
        ),
        'location' => array(
            array(
                array(
                    'param' => 'options_page',
                    'operator' => '==',
                    'value' => 'theme-options-contact',
                ),
            ),
        ),
        'menu_order' => 1,
        'position' => 'normal',
        'style' => 'default',
        'label_placement' => 'top',
        'instruction_placement' => 'label',
        'hide_on_screen' => '',
    ));

    acf_add_local_field_group(array(
        'key' => 'group_plan_commune',
        'title' => 'Plan de la commune',
        'fields' => array(
            array(
                'key' => 'field_plan_commune',
                'label' => 'Lien',
                'name' => 'plan_commune',
                'type' => 'link',
                'required' => 1,
            ),
        ),
        'location' => array(
            array(
                array(
                    'param' => 'options_page',
                    'operator' => '==',
                    'value' => 'theme-options-contact',
                ),
            ),
        ),
        'menu_order' => 2,
        'position' => 'normal',
        'style' => 'default',
        'label_placement' => 'top',
        'instruction_placement' => 'label',
        'hide_on_screen' => '',
    ));

    acf_add_local_field_group(array(
        'key' => 'group_ornex_infos',
        'title' => 'Informations Ornex',
        'fields' => array(
            array(
                'key' => 'field_ornex_infos',
                'label' => 'Lien',
                'name' => 'ornex_infos',
                'type' => 'link',
                'required' => 0,
            ),
        ),
        'location' => array(
            array(
                array(
                    'param' => 'options_page',
                    'operator' => '==',
                    'value' => 'theme-options-contact',
                ),
            ),
        ),
        'menu_order' => 2,
        'position' => 'normal',
        'style' => 'default',
        'label_placement' => 'top',
        'instruction_placement' => 'label',
        'hide_on_screen' => '',
    ));

    acf_add_local_field_group(array(
        'key' => 'group_social_networks',
        'title' => 'Réseaux Sociaux',
        'fields' => array(
            array(
                'key' => 'field_social_networks',
                'label' => 'Réseaux Sociaux',
                'name' => 'social_networks',
                'type' => 'repeater',
                'instructions' => 'Ajoutez vos réseaux sociaux',
                'required' => 0,
                'layout' => 'table',
                'button_label' => 'Ajouter un réseau social',
                'sub_fields' => array(
                    array(
                        'key' => 'field_social_network_url',
                        'label' => 'URL',
                        'name' => 'url',
                        'type' => 'url',
                        'required' => 1,
                    ),
                    array(
                        'key' => 'field_social_network_icon',
                        'label' => 'Reseau social',
                        'name' => 'name',
                        'type' => 'select',
                        'instructions' => 'Sélectionnez un réseau social',
                        'required' => 1,
                        'choices' => array(
                            'facebook' => 'Facebook',
                            'twitter' => 'Twitter',
                            'instagram' => 'Instagram',
                            'linkedin' => 'LinkedIn',
                            'youtube' => 'Youtube',
                            'whatsapp' => 'Whatsapp',
                            'telegram' => 'Telegram',
                            'messenger' => 'Messenger',
                            'tiktok' => 'Tiktok',
                            'x' => 'X',
                            'pinterest' => 'Pinterest',
                            'vimeo' => 'Vimeo',
                        ),
                        'default_value' => array(
                            'Facebook'
                        ),
                    ),
                ),
            ),
        ),
        'location' => array(
            array(
                array(
                    'param' => 'options_page',
                    'operator' => '==',
                    'value' => 'theme-options-contact',
                ),
            ),
        ),
        'menu_order' => 0,
        'position' => 'normal',
        'style' => 'default',
        'label_placement' => 'top',
        'instruction_placement' => 'label',
        'hide_on_screen' => '',
    ));
endif;

