json[ 'default_fonts_title'] = __( 'System Fonts', 'gp-premium' ); $this->json[ 'google_fonts_title'] = __( 'Google Fonts', 'gp-premium' ); $this->json[ 'default_fonts' ] = generate_typography_default_fonts(); $this->json[ 'family_title' ] = esc_html__( 'Font family', 'gp-premium' ); $this->json[ 'weight_title' ] = esc_html__( 'Font weight', 'gp-premium' ); $this->json[ 'transform_title' ] = esc_html__( 'Text transform', 'gp-premium' ); $this->json[ 'category_title' ] = ''; $this->json[ 'variant_title' ] = esc_html__( 'Variants', 'gp-premium' ); foreach ( $this->settings as $setting_key => $setting_id ) { $this->json[ $setting_key ] = array( 'link' => $this->get_link( $setting_key ), 'value' => $this->value( $setting_key ), 'default' => isset( $setting_id->default ) ? $setting_id->default : '', 'id' => isset( $setting_id->id ) ? $setting_id->id : '' ); if ( 'weight' === $setting_key ) { $this->json[ $setting_key ]['choices'] = $this->get_font_weight_choices(); } if ( 'transform' === $setting_key ) { $this->json[ $setting_key ]['choices'] = $this->get_font_transform_choices(); } } } public function content_template() { ?> <# if ( '' !== data.label ) { #> {{ data.label }} <# } #> <# if ( 'undefined' !== typeof ( data.family ) ) { #>
<# } #> <# if ( 'undefined' !== typeof ( data.variant ) ) { #> <# var id = data.family.value.split(' ').join('_').toLowerCase(); var font_data = generatePressTypography.googleFonts[id]; var variants = ''; if ( typeof font_data !== 'undefined' ) { variants = font_data.variants; } if ( null === data.variant.value ) { data.variant.value = data.variant.default; } #>
<# } #> <# if ( 'undefined' !== typeof ( data.category ) ) { #>
<# } #>
<# if ( 'undefined' !== typeof ( data.weight ) ) { #>
<# } #> <# if ( 'undefined' !== typeof ( data.transform ) ) { #>
<# } #>
esc_html__( 'inherit', 'gp-premium' ), 'normal' => esc_html__( 'normal', 'gp-premium' ), 'bold' => esc_html__( 'bold', 'gp-premium' ), '100' => esc_html( '100' ), '200' => esc_html( '200' ), '300' => esc_html( '300' ), '400' => esc_html( '400' ), '500' => esc_html( '500' ), '600' => esc_html( '600' ), '700' => esc_html( '700' ), '800' => esc_html( '800' ), '900' => esc_html( '900' ), ); } public function get_font_transform_choices() { return array( '' => esc_html__( 'inherit', 'gp-premium' ), 'none' => esc_html__( 'none', 'gp-premium' ), 'capitalize' => esc_html__( 'capitalize', 'gp-premium' ), 'uppercase' => esc_html__( 'uppercase', 'gp-premium' ), 'lowercase' => esc_html__( 'lowercase', 'gp-premium' ), ); } } endif;