<?php

/**
 * Pige Title Options
 *
 * @package moving_truck_rental
 */



$wp_customize->add_section(
	'moving_truck_rental_page_title_options',
	array(
		'panel' => 'moving_truck_rental_theme_options',
		'title' => esc_html__( 'Page Title', 'moving-truck-rental' ),
	)
);

$wp_customize->add_setting(
    'moving_truck_rental_page_header_visibility',
    array(
        'default'           => 'all-devices',
        'sanitize_callback' => 'moving_truck_rental_sanitize_select',
    )
);

$wp_customize->add_control(
    new WP_Customize_Control(
        $wp_customize,
        'moving_truck_rental_page_header_visibility',
        array(
            'label'    => esc_html__( 'Page Header Visibility', 'moving-truck-rental' ),
            'type'     => 'select',
            'section'  => 'moving_truck_rental_page_title_options',
            'settings' => 'moving_truck_rental_page_header_visibility',
            'priority' => 10,
            'choices'  => array(
                'all-devices'        => esc_html__( 'Show on all devices', 'moving-truck-rental' ),
                'hide-tablet'        => esc_html__( 'Hide on Tablet', 'moving-truck-rental' ),
                'hide-mobile'        => esc_html__( 'Hide on Mobile', 'moving-truck-rental' ),
                'hide-tablet-mobile' => esc_html__( 'Hide on Tablet & Mobile', 'moving-truck-rental' ),
                'hide-all-devices'   => esc_html__( 'Hide on all devices', 'moving-truck-rental' ),
            ),
        )
    )
);


$wp_customize->add_setting( 'moving_truck_rental_page_title_background_separator', array(
	'sanitize_callback' => 'sanitize_text_field',
) );

$wp_customize->add_control( new Moving_Truck_Rental_Separator_Custom_Control( $wp_customize, 'moving_truck_rental_page_title_background_separator', array(
	'label' => __( 'Page Title BG Image & Color Setting', 'moving-truck-rental' ),
	'section' => 'moving_truck_rental_page_title_options',
	'settings' => 'moving_truck_rental_page_title_background_separator',
)));


$wp_customize->add_setting(
	'moving_truck_rental_page_header_style',
	array(
		'sanitize_callback' => 'moving_truck_rental_sanitize_switch',
		'default'           => False,
	)
);

$wp_customize->add_control(
	new Moving_Truck_Rental_Toggle_Switch_Custom_Control(
		$wp_customize,
		'moving_truck_rental_page_header_style',
		array(
			'label'   => esc_html__('Page Title Background Image', 'moving-truck-rental'),
			'section' => 'moving_truck_rental_page_title_options',
		)
	)
);

$wp_customize->add_setting( 'moving_truck_rental_page_header_background_image', array(
    'default' => '',
    'sanitize_callback' => 'esc_url_raw',
) );

$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'moving_truck_rental_page_header_background_image', array(
    'label'    => __( 'Background Image', 'moving-truck-rental' ),
    'section'  => 'moving_truck_rental_page_title_options',
	'description' => __('Choose either a background image or a color. If a background image is selected, the background color will not be visible.', 'moving-truck-rental'),
    'settings' => 'moving_truck_rental_page_header_background_image',
	'active_callback' => 'moving_truck_rental_is_pagetitle_bcakground_image_enabled',
)));


$wp_customize->add_setting('moving_truck_rental_page_header_image_height', array(
	'default'           => 200,
	'sanitize_callback' => 'moving_truck_rental_sanitize_range_value',
));

$wp_customize->add_control(new Moving_Truck_Rental_Customize_Range_Control($wp_customize, 'moving_truck_rental_page_header_image_height', array(
		'label'       => __('Image Height', 'moving-truck-rental'),
		'section'     => 'moving_truck_rental_page_title_options',
		'settings'    => 'moving_truck_rental_page_header_image_height',
		'active_callback' => 'moving_truck_rental_is_pagetitle_bcakground_image_enabled',
		'input_attrs' => array(
			'min'  => 0,
			'max'  => 1000,
			'step' => 5,
		),
)));


$wp_customize->add_setting('moving_truck_rental_page_title_background_color_setting', array(
    'default' => '#eaeaea',
    'sanitize_callback' => 'sanitize_hex_color',
));

$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'moving_truck_rental_page_title_background_color_setting', array(
    'label' => __('Page Title Background Color', 'moving-truck-rental'),
    'section' => 'moving_truck_rental_page_title_options',
)));

$wp_customize->add_setting('moving_truck_rental_pagetitle_height', array(
    'default'           => 50,
    'sanitize_callback' => 'moving_truck_rental_sanitize_range_value',
));

$wp_customize->add_control(new Moving_Truck_Rental_Customize_Range_Control($wp_customize, 'moving_truck_rental_pagetitle_height', array(
    'label'       => __('Set Height', 'moving-truck-rental'),
    'description' => __('This setting controls the page title height when no background image is set. If a background image is set, this setting will not apply.', 'moving-truck-rental'),
    'section'     => 'moving_truck_rental_page_title_options',
    'settings'    => 'moving_truck_rental_pagetitle_height',
    'input_attrs' => array(
        'min'  => 0,
        'max'  => 300,
        'step' => 5,
    ),
)));

$wp_customize->add_setting( 'moving_truck_rental_page_title_style_separator', array(
	'sanitize_callback' => 'sanitize_text_field',
) );

$wp_customize->add_control( new Moving_Truck_Rental_Separator_Custom_Control( $wp_customize, 'moving_truck_rental_page_title_style_separator', array(
	'label' => __( 'Page Title Styling Setting', 'moving-truck-rental' ),
	'section' => 'moving_truck_rental_page_title_options',
	'settings' => 'moving_truck_rental_page_title_style_separator',
)));

$wp_customize->add_setting( 'moving_truck_rental_page_header_heading_tag', array(
	'default'   => 'h1',
	'sanitize_callback' => 'moving_truck_rental_sanitize_select',
) );

$wp_customize->add_control( 'moving_truck_rental_page_header_heading_tag', array(
	'label'   => __( 'Page Title Heading Tag', 'moving-truck-rental' ),
	'section' => 'moving_truck_rental_page_title_options',
	'type'    => 'select',
	'choices' => array(
		'h1' => __( 'H1', 'moving-truck-rental' ),
		'h2' => __( 'H2', 'moving-truck-rental' ),
		'h3' => __( 'H3', 'moving-truck-rental' ),
		'h4' => __( 'H4', 'moving-truck-rental' ),
		'h5' => __( 'H5', 'moving-truck-rental' ),
		'h6' => __( 'H6', 'moving-truck-rental' ),
		'p' => __( 'p', 'moving-truck-rental' ),
		'a' => __( 'a', 'moving-truck-rental' ),
		'div' => __( 'div', 'moving-truck-rental' ),
		'span' => __( 'span', 'moving-truck-rental' ),
	),
) );

$wp_customize->add_setting('moving_truck_rental_page_header_layout', array(
	'default' => 'left',
	'sanitize_callback' => 'sanitize_text_field',
));

$wp_customize->add_control('moving_truck_rental_page_header_layout', array(
	'label' => __('Style', 'moving-truck-rental'),
	'section' => 'moving_truck_rental_page_title_options',
	'description' => __('"Flex Layout Style" wont work below 600px (mobile media)', 'moving-truck-rental'),
	'settings' => 'moving_truck_rental_page_header_layout',
	'type' => 'radio',
	'choices' => array(
		'left' => __('Classic', 'moving-truck-rental'),
		'right' => __('Aligned Right', 'moving-truck-rental'),
		'center' => __('Centered Focus', 'moving-truck-rental'),
		'flex' => __('Flex Layout', 'moving-truck-rental'),
	),
));