<?php
/**
 * About Section
 *
 * @package Tamal_Portfolio
 */

$wp_customize->add_section(
    'tamal_portfolio_about_section',
    array(
        'panel'    => 'tamal_portfolio_front_page_options',
        'title'    => esc_html__( 'About Section', 'tamal-portfolio' ),
        'priority' => priority_section('tamal_portfolio_about_section'),
    )
);

// About Section - Enable Section.
$wp_customize->add_setting(
    'tamal_portfolio_enable_about_section',
    array(
        'default'           => false,
        'sanitize_callback' => 'tamal_portfolio_sanitize_switch',
    )
);

$wp_customize->add_control(
    new Tamal_Portfolio_Toggle_Switch_Custom_Control(
        $wp_customize,
        'tamal_portfolio_enable_about_section',
        array(
            'label'    => esc_html__( 'Enable About Section', 'tamal-portfolio' ),
            'section'  => 'tamal_portfolio_about_section',
            'settings' => 'tamal_portfolio_enable_about_section',
        )
    )
);

if ( isset( $wp_customize->selective_refresh ) ) {
    $wp_customize->selective_refresh->add_partial(
        'tamal_portfolio_enable_about_section',
        array(
            'selector' => '#about-me .section-link',
            'settings' => 'tamal_portfolio_enable_about_section',
        )
    );
}

// Avatar
$wp_customize->add_setting(
    'tamal_portfolio_about_avatar',
    array(
        'sanitize_callback' => 'tamal_portfolio_sanitize_image',
    )
);
$wp_customize->add_control(
    new WP_Customize_Image_Control(
        $wp_customize,
        'tamal_portfolio_about_avatar',
        array(
            'label'           => esc_html__( 'Avatar Image', 'tamal-portfolio' ),
            'section'         => 'tamal_portfolio_about_section',
            'settings'        => 'tamal_portfolio_about_avatar',
            'active_callback' => 'tamal_portfolio_is_about_section_enabled',
        )
    )
);

$wp_customize->add_setting(
    'tamal_portfolio_about_avatar_size',
    array(
        'default'           => 'small',
        'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control(
    'tamal_portfolio_about_avatar_size',
    array(
        'label'           => esc_html__( 'Select avatar size', 'tamal-portfolio' ),
        'section'         => 'tamal_portfolio_about_section',
        'settings'        => 'tamal_portfolio_about_avatar_size',
        'type'            => 'select',
        'active_callback' => 'tamal_portfolio_is_about_section_enabled',
        'choices'  => array(
            'small' => 'Small',
            'medium' => 'Medium',
            'large' => 'Large',
        )
    )
);

// About Section - Short Description.
$wp_customize->add_setting(
    'tamal_portfolio_about_section_description',
    array(
        'default'           => '<p>Senior UX designer with 7+years experience and specialization in complex web application design.</p>
                                <p>Achieved 15% increase in user satisfaction and 20% increase in conversions through the creation of interactively tested, data-driven, and user-centered design.</p>',
        'sanitize_callback' => 'wp_kses_post',
    )
);
$wp_customize->add_control(
    'tamal_portfolio_about_section_description',
    array(
        'label'           => esc_html__( 'Description', 'tamal-portfolio' ),
        'section'         => 'tamal_portfolio_about_section',
        'settings'        => 'tamal_portfolio_about_section_description',
        'type'            => 'textarea',
        'active_callback' => 'tamal_portfolio_is_about_section_enabled',
    )
);

// Name
$wp_customize->add_setting(
    'tamal_portfolio_about_section_name',
    array(
        'default'           => __( 'I AM TAMAL.', 'tamal-portfolio' ),
        'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control(
    'tamal_portfolio_about_section_name',
    array(
        'label'           => esc_html__( 'Full Name', 'tamal-portfolio' ),
        'section'         => 'tamal_portfolio_about_section',
        'settings'        => 'tamal_portfolio_about_section_name',
        'type'            => 'text',
        'active_callback' => 'tamal_portfolio_is_about_section_enabled',
    )
);

// Short Job
$wp_customize->add_setting(
    'tamal_portfolio_about_section_short_job',
    array(
        'default'           => __( 'UI/UX Designer & Developer', 'tamal-portfolio' ),
        'sanitize_callback' => 'sanitize_text_field',
    )
);
$wp_customize->add_control(
    'tamal_portfolio_about_section_short_job',
    array(
        'label'           => esc_html__( 'Short Job', 'tamal-portfolio' ),
        'section'         => 'tamal_portfolio_about_section',
        'settings'        => 'tamal_portfolio_about_section_short_job',
        'type'            => 'text',
        'active_callback' => 'tamal_portfolio_is_about_section_enabled',
    )
);

