<?php
/**
 * Search Settings
 *
 * @since 1.0.0
 */

/**
 * Image Radio field for search layout
 *
 * @since 1.0.0
 */
$wp_customize->add_setting(
	'trainify_search_layout',
	array(
		'default'           => 'list',
		'sanitize_callback' => 'sanitize_key',
	)
);
$wp_customize->add_control( 
	new TrainifyFramework_Customize_Imageoptions_Control(
		$wp_customize,
		'trainify_search_layout',
		array(
			'label'    => esc_html__( 'Search Layouts', 'trainify' ),
			'description' => esc_html__( 'Choose layout from available layouts', 'trainify' ),
			'section'  => 'template_search_options',
			'choices'  => array(
				'classic' => array(
					'label' => esc_html__( 'Classic', 'trainify' ),
					'url'   => '%s/inc/trainifyframework/assets/img/layouts/layout6.png'
				),
				'grid' => array(
					'label' => esc_html__( 'Grid', 'trainify' ),
					'url'   => '%s/inc/trainifyframework/assets/img/layouts/layout5.png'
				),
				'list' => array(
					'label' => esc_html__( 'List', 'trainify' ),
					'url'   => '%s/assets/img/layout-list.png'
				),
			),
			'priority' => 20
		)
	)
);

$wp_customize->get_setting( 'trainify_framework_readmore_text_search' )->transport = 'postMessage';
$wp_customize->selective_refresh->add_partial( 
	'trainify_framework_readmore_text_search',
	array(
		'selector' => '.tff-search-more > a',
		'render_callback' => 'trainify_customize_partial_search_more',
	)
);
