<?php
/**
 * Tattoopress customizer font mods
 *
 * @package WordPress
 * @subpackage Tattoopress
 * @version 3.3.4
 */

defined( 'ABSPATH' ) || exit;

/**
 * Font mods
 *
 * @param array $mods Array of mods.
 * @return array
 */
function tattoopress_set_font_mods( $mods ) {

	$mods['fonts'] = array(
		'id'      => 'fonts',
		'title'   => esc_html__( 'Fonts', 'tattoopress' ),
		'icon'    => 'editor-textcolor',
		'options' => array(),
	);

	if ( tattoopress_is_elementor_fonts_enabled() ) {

		$mods['fonts']['options']['no_font'] = array(
			'label'       => esc_html__( 'Theme Fonts Disabled', 'tattoopress' ),
			'id'          => 'no_font',
			'type'        => 'text_helper',
			'description' => sprintf(
				tattoopress_kses(
					__( 'Please disable the default fonts options in the <a href="%s" target="_blank">Elementor settings</a> to use the theme font options.', 'tattoopress' )
				),
				esc_url( admin_url( 'admin.php?page=elementor' ) )
			),
		);

		return $mods;
	}

	/**
	 * Get Google Fonts from Font loader
	 */
	$_fonts = apply_filters( 'tattoopress_mods_fonts', tattoopress_get_google_fonts_options() );

	$font_choices = array( 'default' => esc_html__( 'Default', 'tattoopress' ) );

	foreach ( $_fonts as $key => $value ) {
		$font_choices[ $key ] = $key;
	}

	$mods['fonts']['options']['body_font_name'] = array(
		'label'     => esc_html__( 'Body Font Name', 'tattoopress' ),
		'id'        => 'body_font_name',
		'type'      => 'select',
		'choices'   => $font_choices,
		'transport' => 'postMessage',
	);

	$mods['fonts']['options']['body_font_size'] = array(
		'label'       => esc_html__( 'Body Font Size', 'tattoopress' ),
		'id'          => 'body_font_size',
		'type'        => 'text',
		'transport'   => 'postMessage',
		'description' => esc_html__( 'Don\'t ommit px. Leave empty to use the default font size.', 'tattoopress' ),
	);

	/*************************Menu*/

	$mods['fonts']['options']['menu_font_name'] = array(
		'id'        => 'menu_font_name',
		'label'     => esc_html__( 'Menu Font', 'tattoopress' ),
		'type'      => 'select',
		'choices'   => $font_choices,
		'transport' => 'postMessage',
	);

	$mods['fonts']['options']['menu_font_weight'] = array(
		'label'     => esc_html__( 'Menu Font Weight', 'tattoopress' ),
		'id'        => 'menu_font_weight',
		'type'      => 'text',
		'transport' => 'postMessage',
	);

	$mods['fonts']['options']['menu_font_transform'] = array(
		'id'        => 'menu_font_transform',
		'label'     => esc_html__( 'Menu Font Transform', 'tattoopress' ),
		'type'      => 'select',
		'choices'   => array(
			'none'      => esc_html__( 'None', 'tattoopress' ),
			'uppercase' => esc_html__( 'Uppercase', 'tattoopress' ),
			'lowercase' => esc_html__( 'Lowercase', 'tattoopress' ),
		),
		'transport' => 'postMessage',
	);

	$mods['fonts']['options']['menu_font_letter_spacing'] = array(
		'label'     => esc_html__( 'Menu Letter Spacing (omit px)', 'tattoopress' ),
		'id'        => 'menu_font_letter_spacing',
		'type'      => 'int',
		'transport' => 'postMessage',
	);

	$mods['fonts']['options']['menu_font_style'] = array(
		'id'        => 'menu_font_style',
		'label'     => esc_html__( 'Menu Font Style', 'tattoopress' ),
		'type'      => 'select',
		'choices'   => array(
			'normal'  => esc_html__( 'Normal', 'tattoopress' ),
			'italic'  => esc_html__( 'Italic', 'tattoopress' ),
			'oblique' => esc_html__( 'Oblique', 'tattoopress' ),
		),
		'transport' => 'postMessage',
	);

	$mods['fonts']['options']['submenu_font_name'] = array(
		'id'        => 'submenu_font_name',
		'label'     => esc_html__( 'Submenu Font', 'tattoopress' ),
		'type'      => 'select',
		'choices'   => $font_choices,
		'transport' => 'postMessage',
	);

	$mods['fonts']['options']['submenu_font_weight'] = array(
		'label'     => esc_html__( 'Submenu Font Weight', 'tattoopress' ),
		'id'        => 'submenu_font_weight',
		'type'      => 'text',
		'transport' => 'postMessage',
	);

	$mods['fonts']['options']['submenu_font_transform'] = array(
		'id'        => 'submenu_font_transform',
		'label'     => esc_html__( 'Submenu Font Transform', 'tattoopress' ),
		'type'      => 'select',
		'choices'   => array(
			'none'      => esc_html__( 'None', 'tattoopress' ),
			'uppercase' => esc_html__( 'Uppercase', 'tattoopress' ),
			'lowercase' => esc_html__( 'Lowercase', 'tattoopress' ),
		),
		'transport' => 'postMessage',
	);

	$mods['fonts']['options']['submenu_font_style'] = array(
		'id'        => 'submenu_font_style',
		'label'     => esc_html__( 'Submenu Font Style', 'tattoopress' ),
		'type'      => 'select',
		'choices'   => array(
			'normal'  => esc_html__( 'Normal', 'tattoopress' ),
			'italic'  => esc_html__( 'Italic', 'tattoopress' ),
			'oblique' => esc_html__( 'Oblique', 'tattoopress' ),
		),
		'transport' => 'postMessage',
	);

	$mods['fonts']['options']['submenu_font_letter_spacing'] = array(
		'label'     => esc_html__( 'Submenu Letter Spacing (omit px)', 'tattoopress' ),
		'id'        => 'submenu_font_letter_spacing',
		'type'      => 'int',
		'transport' => 'postMessage',
	);

	/*************************Heading*/

	$mods['fonts']['options']['heading_font_name'] = array(
		'id'        => 'heading_font_name',
		'label'     => esc_html__( 'Heading Font', 'tattoopress' ),
		'type'      => 'select',
		'choices'   => $font_choices,
		'transport' => 'postMessage',
	);

	$mods['fonts']['options']['heading_font_weight'] = array(
		'label'       => esc_html__( 'Heading Font weight', 'tattoopress' ),
		'id'          => 'heading_font_weight',
		'type'        => 'text',
		'description' => esc_html__( 'For example: "400" is normal, "700" is bold.The available font weights depend on the font.', 'tattoopress' ),
		'transport'   => 'postMessage',
	);

	$mods['fonts']['options']['heading_font_transform'] = array(
		'id'        => 'heading_font_transform',
		'label'     => esc_html__( 'Heading Font Transform', 'tattoopress' ),
		'type'      => 'select',
		'choices'   => array(
			'none'      => esc_html__( 'None', 'tattoopress' ),
			'uppercase' => esc_html__( 'Uppercase', 'tattoopress' ),
			'lowercase' => esc_html__( 'Lowercase', 'tattoopress' ),
		),
		'transport' => 'postMessage',
	);

	$mods['fonts']['options']['heading_font_style'] = array(
		'id'        => 'heading_font_style',
		'label'     => esc_html__( 'Heading Font Style', 'tattoopress' ),
		'type'      => 'select',
		'choices'   => array(
			'normal'  => esc_html__( 'Normal', 'tattoopress' ),
			'italic'  => esc_html__( 'Italic', 'tattoopress' ),
			'oblique' => esc_html__( 'Oblique', 'tattoopress' ),
		),
		'transport' => 'postMessage',
	);

	$mods['fonts']['options']['heading_font_letter_spacing'] = array(
		'label'     => esc_html__( 'Heading Letter Spacing (omit px)', 'tattoopress' ),
		'id'        => 'heading_font_letter_spacing',
		'type'      => 'int',
		'transport' => 'postMessage',
	);

	return $mods;

}
add_filter( 'tattoopress_customizer_mods', 'tattoopress_set_font_mods', 10 );
