Skip to content

Commit

Permalink
Apply new control for all font-family fields VisualComposer#328
Browse files Browse the repository at this point in the history
  • Loading branch information
dmytro-kovalov committed Jul 6, 2022
1 parent 410bf20 commit f44c96a
Showing 1 changed file with 126 additions and 72 deletions.
198 changes: 126 additions & 72 deletions inc/customizer/class-visualcomposerstarter-customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1454,7 +1454,7 @@ private function vct_woocommerce( $wp_customize ) {
/**
* H1 fonts and style section
*
* @param object $wp_customize Customizer object.
* @param WP_Customize_Manager $wp_customize Customizer object.
*/
private function fonts_and_style_section_h1( $wp_customize ) {
$wp_customize->add_setting( 'vct_fonts_and_style_h1_text_color', array(
Expand All @@ -1467,8 +1467,9 @@ private function fonts_and_style_section_h1( $wp_customize ) {
) );

$wp_customize->add_setting( 'vct_fonts_and_style_h1_font_family', array(
'default' => 'Montserrat',
'default' => 'Montserrat, sans-serif',
'sanitize_callback' => array( $this, 'sanitize_select_google_fonts' ),
'transport' => 'postMessage',
) );

$wp_customize->add_setting( 'vct_fonts_and_style_h1_subsets', array(
Expand Down Expand Up @@ -1537,13 +1538,20 @@ private function fonts_and_style_section_h1( $wp_customize ) {
)
)
);
$wp_customize->add_control( 'vct_fonts_and_style_h1_font_family', array(
'label' => esc_html__( 'Font-family', 'visual-composer-starter' ),
'section' => 'vct_fonts_and_style_h1',
'settings' => 'vct_fonts_and_style_h1_font_family',
'type' => 'select',
'choices' => VisualComposerStarter_Fonts::vct_theme_font_choices(),
) );

$wp_customize->add_control(
new VisualComposerStarter_Google_Fonts_Control(
$wp_customize,
'vct_fonts_and_style_h1_font_family',
array(
'label' => esc_html__( 'Font-family', 'visual-composer-starter' ),
'section' => 'vct_fonts_and_style_h1',
'settings' => 'vct_fonts_and_style_h1_font_family',
'choices' => VisualComposerStarter_Fonts::vct_theme_font_choices(),
)
)
);

$wp_customize->add_control( 'vct_fonts_and_style_h1_subsets', array(
'label' => esc_html__( 'Google Fonts Subsets', 'visual-composer-starter' ),
'section' => 'vct_fonts_and_style_h1',
Expand Down Expand Up @@ -1622,7 +1630,7 @@ private function fonts_and_style_section_h1( $wp_customize ) {
/**
* H2 fonts and style section
*
* @param object $wp_customize Customizer object.
* @param WP_Customize_Manager $wp_customize Customizer object.
*/
private function fonts_and_style_section_h2( $wp_customize ) {
$wp_customize->add_setting( 'vct_fonts_and_style_h2_text_color', array(
Expand All @@ -1635,8 +1643,9 @@ private function fonts_and_style_section_h2( $wp_customize ) {
) );

$wp_customize->add_setting( 'vct_fonts_and_style_h2_font_family', array(
'default' => 'Montserrat',
'default' => 'Montserrat, sans-serif',
'sanitize_callback' => array( $this, 'sanitize_select_google_fonts' ),
'transport' => 'postMessage',
) );

$wp_customize->add_setting( 'vct_fonts_and_style_h2_subsets', array(
Expand Down Expand Up @@ -1702,13 +1711,18 @@ private function fonts_and_style_section_h2( $wp_customize ) {
)
);

$wp_customize->add_control( 'vct_fonts_and_style_h2_font_family', array(
'label' => esc_html__( 'Font-family', 'visual-composer-starter' ),
'section' => 'vct_fonts_and_style_h2',
'settings' => 'vct_fonts_and_style_h2_font_family',
'type' => 'select',
'choices' => VisualComposerStarter_Fonts::vct_theme_font_choices(),
) );
$wp_customize->add_control(
new VisualComposerStarter_Google_Fonts_Control(
$wp_customize,
'vct_fonts_and_style_h2_font_family',
array(
'label' => esc_html__( 'Font-family', 'visual-composer-starter' ),
'section' => 'vct_fonts_and_style_h2',
'settings' => 'vct_fonts_and_style_h2_font_family',
'choices' => VisualComposerStarter_Fonts::vct_theme_font_choices(),
)
)
);

$wp_customize->add_control( 'vct_fonts_and_style_h2_subsets', array(
'label' => esc_html__( 'Google Fonts Subsets', 'visual-composer-starter' ),
Expand Down Expand Up @@ -1793,7 +1807,7 @@ private function fonts_and_style_section_h2( $wp_customize ) {
/**
* H3 fonts and style section
*
* @param object $wp_customize Customizer object.
* @param WP_Customize_Manager $wp_customize Customizer object.
*/
private function fonts_and_style_section_h3( $wp_customize ) {
$wp_customize->add_setting( 'vct_fonts_and_style_h3_text_color', array(
Expand All @@ -1805,8 +1819,9 @@ private function fonts_and_style_section_h3( $wp_customize ) {
'sanitize_callback' => 'sanitize_hex_color',
) );
$wp_customize->add_setting( 'vct_fonts_and_style_h3_font_family', array(
'default' => 'Montserrat',
'default' => 'Montserrat, sans-serif',
'sanitize_callback' => array( $this, 'sanitize_select_google_fonts' ),
'transport' => 'postMessage',
) );
$wp_customize->add_setting( 'vct_fonts_and_style_h3_subsets', array(
'default' => 'all',
Expand Down Expand Up @@ -1867,13 +1882,20 @@ private function fonts_and_style_section_h3( $wp_customize ) {
)
)
);
$wp_customize->add_control( 'vct_fonts_and_style_h3_font_family', array(
'label' => esc_html__( 'Font-family', 'visual-composer-starter' ),
'section' => 'vct_fonts_and_style_h3',
'settings' => 'vct_fonts_and_style_h3_font_family',
'type' => 'select',
'choices' => VisualComposerStarter_Fonts::vct_theme_font_choices(),
) );

$wp_customize->add_control(
new VisualComposerStarter_Google_Fonts_Control(
$wp_customize,
'vct_fonts_and_style_h3_font_family',
array(
'label' => esc_html__( 'Font-family', 'visual-composer-starter' ),
'section' => 'vct_fonts_and_style_h3',
'settings' => 'vct_fonts_and_style_h3_font_family',
'choices' => VisualComposerStarter_Fonts::vct_theme_font_choices(),
)
)
);

$wp_customize->add_control( 'vct_fonts_and_style_h3_subsets', array(
'label' => esc_html__( 'Google Fonts Subsets', 'visual-composer-starter' ),
'section' => 'vct_fonts_and_style_h3',
Expand Down Expand Up @@ -1955,7 +1977,7 @@ private function fonts_and_style_section_h3( $wp_customize ) {
/**
* H4 fonts and style section
*
* @param object $wp_customize Customizer object.
* @param WP_Customize_Manager $wp_customize Customizer object.
*/
private function fonts_and_style_section_h4( $wp_customize ) {
$wp_customize->add_setting( 'vct_fonts_and_style_h4_text_color', array(
Expand All @@ -1966,9 +1988,11 @@ private function fonts_and_style_section_h4( $wp_customize ) {
'default' => '#557cbf',
'sanitize_callback' => 'sanitize_hex_color',
) );

$wp_customize->add_setting( 'vct_fonts_and_style_h4_font_family', array(
'default' => 'Montserrat',
'default' => 'Montserrat, sans-serif',
'sanitize_callback' => array( $this, 'sanitize_select_google_fonts' ),
'transport' => 'postMessage',
) );

$wp_customize->add_setting( 'vct_fonts_and_style_h4_subsets', array(
Expand Down Expand Up @@ -2034,13 +2058,18 @@ private function fonts_and_style_section_h4( $wp_customize ) {
)
);

$wp_customize->add_control( 'vct_fonts_and_style_h4_font_family', array(
'label' => esc_html__( 'Font-family', 'visual-composer-starter' ),
'section' => 'vct_fonts_and_style_h4',
'settings' => 'vct_fonts_and_style_h4_font_family',
'type' => 'select',
'choices' => VisualComposerStarter_Fonts::vct_theme_font_choices(),
) );
$wp_customize->add_control(
new VisualComposerStarter_Google_Fonts_Control(
$wp_customize,
'vct_fonts_and_style_h4_font_family',
array(
'label' => esc_html__( 'Font-family', 'visual-composer-starter' ),
'section' => 'vct_fonts_and_style_h4',
'settings' => 'vct_fonts_and_style_h4_font_family',
'choices' => VisualComposerStarter_Fonts::vct_theme_font_choices(),
)
)
);

$wp_customize->add_control( 'vct_fonts_and_style_h4_subsets', array(
'label' => esc_html__( 'Google Fonts Subsets', 'visual-composer-starter' ),
Expand Down Expand Up @@ -2124,7 +2153,7 @@ private function fonts_and_style_section_h4( $wp_customize ) {
/**
* H5 fonts and style section
*
* @param object $wp_customize Customizer object.
* @param WP_Customize_Manager $wp_customize Customizer object.
*/
private function fonts_and_style_section_h5( $wp_customize ) {
$wp_customize->add_setting( 'vct_fonts_and_style_h5_text_color', array(
Expand All @@ -2135,9 +2164,11 @@ private function fonts_and_style_section_h5( $wp_customize ) {
'default' => '#557cbf',
'sanitize_callback' => 'sanitize_hex_color',
) );

$wp_customize->add_setting( 'vct_fonts_and_style_h5_font_family', array(
'default' => 'Montserrat',
'default' => 'Montserrat, sans-serif',
'sanitize_callback' => array( $this, 'sanitize_select_google_fonts' ),
'transport' => 'postMessage',
) );

$wp_customize->add_setting( 'vct_fonts_and_style_h5_subsets', array(
Expand Down Expand Up @@ -2202,13 +2233,18 @@ private function fonts_and_style_section_h5( $wp_customize ) {
)
);

$wp_customize->add_control( 'vct_fonts_and_style_h5_font_family', array(
'label' => esc_html__( 'Font-family', 'visual-composer-starter' ),
'section' => 'vct_fonts_and_style_h5',
'settings' => 'vct_fonts_and_style_h5_font_family',
'type' => 'select',
'choices' => VisualComposerStarter_Fonts::vct_theme_font_choices(),
) );
$wp_customize->add_control(
new VisualComposerStarter_Google_Fonts_Control(
$wp_customize,
'vct_fonts_and_style_h5_font_family',
array(
'label' => esc_html__( 'Font-family', 'visual-composer-starter' ),
'section' => 'vct_fonts_and_style_h5',
'settings' => 'vct_fonts_and_style_h5_font_family',
'choices' => VisualComposerStarter_Fonts::vct_theme_font_choices(),
)
)
);

$wp_customize->add_control( 'vct_fonts_and_style_h5_subsets', array(
'label' => esc_html__( 'Google Fonts Subsets', 'visual-composer-starter' ),
Expand Down Expand Up @@ -2292,7 +2328,7 @@ private function fonts_and_style_section_h5( $wp_customize ) {
/**
* H6 fonts and style section
*
* @param object $wp_customize Customizer object.
* @param WP_Customize_Manager $wp_customize Customizer object.
*/
private function fonts_and_style_section_h6( $wp_customize ) {
$wp_customize->add_setting( 'vct_fonts_and_style_h6_text_color', array(
Expand All @@ -2303,9 +2339,11 @@ private function fonts_and_style_section_h6( $wp_customize ) {
'default' => '#557cbf',
'sanitize_callback' => 'sanitize_hex_color',
) );

$wp_customize->add_setting( 'vct_fonts_and_style_h6_font_family', array(
'default' => 'Montserrat',
'default' => 'Montserrat, sans-serif',
'sanitize_callback' => array( $this, 'sanitize_select_google_fonts' ),
'transport' => 'postMessage',
) );

$wp_customize->add_setting( 'vct_fonts_and_style_h6_subsets', array(
Expand Down Expand Up @@ -2370,13 +2408,18 @@ private function fonts_and_style_section_h6( $wp_customize ) {
)
);

$wp_customize->add_control( 'vct_fonts_and_style_h6_font_family', array(
'label' => esc_html__( 'Font-family', 'visual-composer-starter' ),
'section' => 'vct_fonts_and_style_h6',
'settings' => 'vct_fonts_and_style_h6_font_family',
'type' => 'select',
'choices' => VisualComposerStarter_Fonts::vct_theme_font_choices(),
) );
$wp_customize->add_control(
new VisualComposerStarter_Google_Fonts_Control(
$wp_customize,
'vct_fonts_and_style_h6_font_family',
array(
'label' => esc_html__( 'Font-family', 'visual-composer-starter' ),
'section' => 'vct_fonts_and_style_h6',
'settings' => 'vct_fonts_and_style_h6_font_family',
'choices' => VisualComposerStarter_Fonts::vct_theme_font_choices(),
)
)
);

$wp_customize->add_control( 'vct_fonts_and_style_h6_subsets', array(
'label' => esc_html__( 'Google Fonts Subsets', 'visual-composer-starter' ),
Expand Down Expand Up @@ -2464,7 +2507,7 @@ private function fonts_and_style_section_h6( $wp_customize ) {
/**
* Body fonts and style section
*
* @param object $wp_customize Customizer object.
* @param WP_Customize_Manager $wp_customize Customizer object.
*/
private function fonts_and_style_section_body( $wp_customize ) {
$wp_customize->add_setting( 'vct_fonts_and_style_body_primary_color', array(
Expand All @@ -2482,8 +2525,9 @@ private function fonts_and_style_section_body( $wp_customize ) {
) );

$wp_customize->add_setting( 'vct_fonts_and_style_body_font_family', array(
'default' => 'Roboto, sans-serif',
'default' => 'Roboto, sans-serif',
'sanitize_callback' => array( $this, 'sanitize_select_google_fonts' ),
'transport' => 'postMessage',
) );

$wp_customize->add_setting( 'vct_fonts_and_style_body_subsets', array(
Expand Down Expand Up @@ -2563,13 +2607,17 @@ private function fonts_and_style_section_body( $wp_customize ) {
)
);

$wp_customize->add_control( 'vct_fonts_and_style_body_font_family', array(
'label' => esc_html__( 'Font-family', 'visual-composer-starter' ),
'section' => 'vct_fonts_and_style_body',
'settings' => 'vct_fonts_and_style_body_font_family',
'type' => 'select',
'choices' => VisualComposerStarter_Fonts::vct_theme_font_choices(),
) );
$wp_customize->add_control(
new VisualComposerStarter_Google_Fonts_Control(
$wp_customize,
'vct_fonts_and_style_body_font_family', array(
'label' => esc_html__( 'Font-family', 'visual-composer-starter' ),
'section' => 'vct_fonts_and_style_body',
'settings' => 'vct_fonts_and_style_body_font_family',
'choices' => VisualComposerStarter_Fonts::vct_theme_font_choices(),
)
)
);

$wp_customize->add_control( 'vct_fonts_and_style_body_subsets', array(
'label' => esc_html__( 'Google Fonts Subsets', 'visual-composer-starter' ),
Expand Down Expand Up @@ -2653,7 +2701,7 @@ private function fonts_and_style_section_body( $wp_customize ) {
/**
* Buttons fonts and style section
*
* @param object $wp_customize Customizer object.
* @param WP_Customize_Manager $wp_customize Customizer object.
*/
private function fonts_and_style_section_buttons( $wp_customize ) {
$wp_customize->add_setting( 'vct_fonts_and_style_buttons_background_color', array(
Expand All @@ -2674,8 +2722,9 @@ private function fonts_and_style_section_buttons( $wp_customize ) {
) );

$wp_customize->add_setting( 'vct_fonts_and_style_buttons_font_family', array(
'default' => 'Montserrat',
'default' => 'Montserrat, sans-serif',
'sanitize_callback' => array( $this, 'sanitize_select_google_fonts' ),
'transport' => 'postMessage',
) );

$wp_customize->add_setting( 'vct_fonts_and_style_buttons_subsets', array(
Expand Down Expand Up @@ -2765,13 +2814,18 @@ private function fonts_and_style_section_buttons( $wp_customize ) {
)
);

$wp_customize->add_control( 'vct_fonts_and_style_buttons_font_family', array(
'label' => esc_html__( 'Font-family', 'visual-composer-starter' ),
'section' => 'vct_fonts_and_style_buttons',
'settings' => 'vct_fonts_and_style_buttons_font_family',
'type' => 'select',
'choices' => VisualComposerStarter_Fonts::vct_theme_font_choices(),
) );
$wp_customize->add_control(
new VisualComposerStarter_Google_Fonts_Control(
$wp_customize,
'vct_fonts_and_style_buttons_font_family',
array(
'label' => esc_html__( 'Font-family', 'visual-composer-starter' ),
'section' => 'vct_fonts_and_style_buttons',
'settings' => 'vct_fonts_and_style_buttons_font_family',
'choices' => VisualComposerStarter_Fonts::vct_theme_font_choices(),
)
)
);

$wp_customize->add_control( 'vct_fonts_and_style_buttons_subsets', array(
'label' => esc_html__( 'Google Fonts Subsets', 'visual-composer-starter' ),
Expand Down

0 comments on commit f44c96a

Please sign in to comment.