add_control( new Themeoo_Customize_Misc_Control( $wp_customize, $font_setting_id, array( 'section' => $section_id, 'type' => 'heading', 'label' => $group_label, ) ) ); if ( ! in_array( 'family', $exclude ) ) : $setting_id = $font_setting_id . '_font_family'; $wp_customize->add_setting( $setting_id, array( 'default' => themeoo_get_default( $setting_id ), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_attr', ) ); $wp_customize->add_control( new Themeoo_Google_Fonts_Custom_Control( $wp_customize, $setting_id, array( 'label' => 'Font Family', 'section' => $section_id, 'settings' => $setting_id, ) ) ); endif; if ( ! in_array( 'variant', $exclude ) ) : $setting_id = $font_setting_id . '_font_variant'; $values = themeoo_get_default( $setting_id ); $wp_customize->add_setting( $setting_id, array( 'default' => $values, 'type' => 'theme_mod', 'sanitize_callback' => 'themeoo_sanitize_font_variant_array', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, $setting_id, [ 'label' => __( 'Font Variant', 'ayyash' ), 'description' => __( 'Different variants of the font, provides control over font-weight and italics', 'ayyash' ), 'section' => $section_id, 'settings' => $setting_id, 'type' => 'select', 'choices' => [ 'regular' => 'Regular', ], ] ) ); // @TODO make this variant extra hidden. // as browser don't download any font unit it found right usage, // so we can safely load all the variants and let use choose default variant. // We can't load variation information from the json as it will take some time, and make the site slow. // So in hidden input save inject all the variants of selected font. // Check fontChosen object. $setting_id = $font_setting_id . '_font_variant_extra'; $values_extra = themeoo_get_default( $setting_id ); if ( empty( $values_extra ) ) { $values_extra = $values; } if ( ! is_array( $values_extra ) ) { $values_extra = empty( $values_extra ) ? [] : [ $values_extra ]; } $wp_customize->add_setting( $setting_id, array( 'default' => $values_extra, 'type' => 'theme_mod', 'sanitize_callback' => 'themeoo_sanitize_font_variant_array', ) ); $wp_customize->add_control( new Themeoo_Multi_Select_Control( $wp_customize, $setting_id, [ 'label' => __( 'Extra Font Variant', 'ayyash' ), 'description' => __( 'Extra variants to use in editors and custom sections.', 'ayyash' ), 'section' => $section_id, 'settings' => $setting_id, 'choices' => [ 'regular' => 'Regular', ], ] ) ); endif; if ( ! in_array( 'size', $exclude ) ) : $setting_id = $font_setting_id . '_font_size'; $wp_customize->add_setting( $setting_id, array( 'default' => themeoo_get_default( $setting_id ), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_attr', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, $setting_id, array( 'label' => __( 'Font Size (px)', 'ayyash' ), 'section' => $section_id, 'settings' => $setting_id, ) ) ); endif; if ( ! in_array( 'line_height', $exclude ) ) : $setting_id = $font_setting_id . '_line_height'; $wp_customize->add_setting( $setting_id, array( 'default' => themeoo_get_default( $setting_id ), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_attr', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, $setting_id, array( 'label' => __( 'Line Height (em)', 'ayyash' ), 'section' => $section_id, 'settings' => $setting_id, ) ) ); endif; if ( ! in_array( 'text_transform', $exclude ) ) : $setting_id = $font_setting_id . '_text_transform'; $wp_customize->add_setting( $setting_id, array( 'default' => themeoo_get_default( $setting_id ), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_attr', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, $setting_id, array( 'label' => __( 'Text Transform', 'ayyash' ), 'section' => $section_id, 'settings' => $setting_id, 'type' => 'select', 'choices' => array( 'none' => __( 'None', 'ayyash' ), 'uppercase' => __( 'Uppercase', 'ayyash' ), 'lowercase' => __( 'Lowercase', 'ayyash' ), ), ) ) ); endif; if ( ! in_array( 'letter_spacing', $exclude ) ) : $setting_id = $font_setting_id . '_letter_spacing'; $wp_customize->add_setting( $setting_id, array( 'default' => themeoo_get_default( $setting_id ), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_attr', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, $setting_id, array( 'label' => __( 'Letter Spacing (px)', 'ayyash' ), 'section' => $section_id, 'settings' => $setting_id, ) ) ); endif; if ( ! in_array( 'word_spacing', $exclude ) ) : $setting_id = $font_setting_id . '_word_spacing'; $wp_customize->add_setting( $setting_id, array( 'default' => themeoo_get_default( $setting_id ), 'type' => 'theme_mod', 'sanitize_callback' => 'esc_attr', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, $setting_id, array( 'label' => __( 'Word Spacing (px)', 'ayyash' ), 'section' => $section_id, 'settings' => $setting_id, ) ) ); endif; } endif;