<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

/**
 * Frontpage Crafted with Care Section Options
 * @package pawfect
 */

if ( ! class_exists( 'Pawfect_Options_Crafted' ) ) :

    class Pawfect_Options_Crafted extends pawfect_Customize_Base_Option {

        public function elements() {
            return array(

                'pawfect_crafted_heading' => array(
                    'setting' => array(),
                    'control' => array(
                        'type' => 'heading',
                        'priority' => 1,
                        'label' => esc_html__('Crafted with Care Section', 'pawfect'),
                        'section' => 'pawfect_crafted_section',
                    ),
                ),

                'pawfect_crafted_enabled' => array(
                    'setting' => array(
                        'default' => true,
                        'sanitize_callback' => array('pawfect_Customizer_Sanitize', 'sanitize_checkbox'),
                    ),
                    'control' => array(
                        'type' => 'toggle',
                        'priority' => 2,
                        'label' => esc_html__('Enable Section', 'pawfect'),
                        'section' => 'pawfect_crafted_section',
                    ),
                ),

                'pawfect_crafted_title' => array(
                    'setting' => array(
                        'default' => esc_html__('Crafted with Care', 'pawfect'),
                        'sanitize_callback' => 'sanitize_text_field',
                    ),
                    'control' => array(
                        'type' => 'text',
                        'priority' => 3,
                        'label' => esc_html__('Title', 'pawfect'),
                        'section' => 'pawfect_crafted_section',
                         'active_callback' => 'pawfect_crafted_enabled',
                    ),
                ),

                'pawfect_crafted_desc' => array(
                    'setting' => array(
                        'default' => esc_html__('We create products that make tails wag and whiskers wiggle...', 'pawfect'),
                        'sanitize_callback' => 'sanitize_textarea_field',
                    ),
                    'control' => array(
                        'type' => 'textarea',
                        'priority' => 4,
                        'label' => esc_html__('Description', 'pawfect'),
                        'section' => 'pawfect_crafted_section',
                        'active_callback' => 'pawfect_crafted_enabled',
                    ),
                ),

                'pawfect_crafted_button_text' => array(
                    'setting' => array(
                        'default' => esc_html__('Learn More', 'pawfect'),
                        'sanitize_callback' => 'sanitize_text_field',
                    ),
                    'control' => array(
                        'type' => 'text',
                        'priority' => 5,
                        'label' => esc_html__('Button Text', 'pawfect'),
                        'section' => 'pawfect_crafted_section',
                        'active_callback' => 'pawfect_crafted_enabled',
                    ),
                ),

                'pawfect_crafted_button_link' => array(
                    'setting' => array(
                        'default' => '#',
                        'sanitize_callback' => 'esc_url_raw',
                    ),
                    'control' => array(
                        'type' => 'url',
                        'priority' => 6,
                        'label' => esc_html__('Button Link', 'pawfect'),
                        'section' => 'pawfect_crafted_section',
                        'active_callback' => 'pawfect_crafted_enabled',
                    ),
                ),

                'pawfect_crafted_button_target' => array(
                    'setting' => array(
                        'default' => '_self',
                        'sanitize_callback' => array('pawfect_Customizer_Sanitize', 'sanitize_radio'),
                    ),
                    'control' => array(
                        'type' => 'radio-switch',
                        'priority' => 7,
                        'label' => esc_html__('Button Link Target', 'pawfect'),
                        'section' => 'pawfect_crafted_section',
                        'choices' => array(
                            '_self' => esc_html__('Same Tab', 'pawfect'),
                            '_blank' => esc_html__('New Tab', 'pawfect'),
                        ),
                        'active_callback' => 'pawfect_crafted_enabled',
                    ),
                ),

                'pawfect_crafted_image_1' => array(
                    'setting' => array(
                        'default' => PAWFECT_THEME_URL . '/assets/images/pet-love.webp',
                        'sanitize_callback' => 'esc_url_raw',
                    ),
                    'control' => array(
                        'type' => 'image',
                        'priority' => 8,
                        'label' => esc_html__('Left Image', 'pawfect'),
                        'section' => 'pawfect_crafted_section',
                        'active_callback' => 'pawfect_crafted_enabled',
                    ),
                ),

                'pawfect_crafted_image_2' => array(
                    'setting' => array(
                        'default' => PAWFECT_THEME_URL . '/assets/images/pet-love2.webp',
                        'sanitize_callback' => 'esc_url_raw',
                    ),
                    'control' => array(
                        'type' => 'image',
                        'priority' => 9,
                        'label' => esc_html__('Right Image', 'pawfect'),
                        'section' => 'pawfect_crafted_section',
                         'active_callback' => 'pawfect_crafted_enabled',
                    ),
                ),

                'pawfect_crafted_container' => array(
                    'setting' => array(
                        'default' => 'pawfect-container-narrow',
                        'sanitize_callback' => 'sanitize_text_field',
                    ),
                    'control' => array(
                        'type' => 'radio-switch',
                        'priority' => 10,
                        'label' => esc_html__('Container Width', 'pawfect'),
                        'section' => 'pawfect_crafted_section',
                        'choices' => array(
                            'pawfect-container-narrow' => esc_html__('Narrow Container', 'pawfect'),
                            'pawfect-container' => esc_html__('Default Container', 'pawfect'),
                            'container-full' => esc_html__('Full Width', 'pawfect'),
                        ),
                        'active_callback' => 'pawfect_crafted_enabled',
                    ),
                ),
            );
        }
    }

    new Pawfect_Options_Crafted();

endif;
function pawfect_crafted_enabled($control)
{
    return get_theme_mod('pawfect_crafted_enabled', true) === true;
}


