json['default_fonts_title'] = __( 'System fonts', 'generatepress' ); $this->json['google_fonts_title'] = __( 'Google fonts', 'generatepress' ); $this->json['google_fonts'] = apply_filters( 'generate_typography_customize_list', generate_get_all_google_fonts( $number_of_fonts ) ); $this->json['default_fonts'] = generate_typography_default_fonts(); $this->json['family_title'] = esc_html__( 'Font family', 'generatepress' ); $this->json['weight_title'] = esc_html__( 'Font weight', 'generatepress' ); $this->json['transform_title'] = esc_html__( 'Text transform', 'generatepress' ); $this->json['category_title'] = ''; $this->json['variant_title'] = esc_html__( 'Variants', 'generatepress' ); 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 = data.google_fonts[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( 'normal' ), 'bold' => esc_html( 'bold' ), '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( 'none' => esc_html( 'none' ), 'capitalize' => esc_html( 'capitalize' ), 'uppercase' => esc_html( 'uppercase' ), 'lowercase' => esc_html( 'lowercase' ), ); } } }