<?php
/**
 * Breadcrumb settings
 */

$wp_customize->add_section(
	'blooming_blog_breadcrumb_section',
	array(
		'title' => esc_html__( 'Breadcrumb Options', 'blooming-blog' ),
		'panel' => 'blooming_blog_theme_options_panel',
	)
);

// Breadcrumb enable setting.
$wp_customize->add_setting(
	'blooming_blog_breadcrumb_enable',
	array(
		'default'           => true,
		'sanitize_callback' => 'blooming_blog_sanitize_checkbox',
	)
);
$wp_customize->add_control(
	new Blooming_Blog_Toggle_Checkbox_Custom_control(
		$wp_customize,
		'blooming_blog_breadcrumb_enable',
		array(
			'label'    => esc_html__( 'Enable breadcrumb.', 'blooming-blog' ),
			'type'     => 'checkbox',
			'settings' => 'blooming_blog_breadcrumb_enable',
			'section'  => 'blooming_blog_breadcrumb_section',
		)
	)
);

// Breadcrumb - Separator.
$wp_customize->add_setting(
	'blooming_blog_breadcrumb_separator',
	array(
		'sanitize_callback' => 'sanitize_text_field',
		'default'           => '/',
	)
);

$wp_customize->add_control(
	'blooming_blog_breadcrumb_separator',
	array(
		'label'           => esc_html__( 'Separator', 'blooming-blog' ),
		'section'         => 'blooming_blog_breadcrumb_section',
		'active_callback' => function( $control ) {
			return ( $control->manager->get_setting( 'blooming_blog_breadcrumb_enable' )->value() );
		},
	)
);
