choices['fonts'] ) && ( isset( $this->choices['fonts']['google'] ) || isset( $this->choices['fonts']['standard'] ) ) && ( ! empty( $this->choices['fonts']['google'] ) || ! empty( $this->choices['fonts']['standard'] ) ) ); $localize_script_var = ( $custom_fonts_array ) ? 'hooFonts' . $this->id : 'hooAllFonts'; wp_localize_script( $script_to_localize, $localize_script_var, array( 'standard' => $this->get_standard_fonts(), 'google' => $this->get_google_fonts(), ) ); } /** * Refresh the parameters passed to the JavaScript via JSON. * * @see WP_Customize_Control::to_json() */ public function to_json() { parent::to_json(); $this->json['default'] = $this->setting->default; if ( isset( $this->default ) ) { $this->json['default'] = $this->default; } $this->json['output'] = $this->output; $this->json['value'] = Hoo_Field_Typography::sanitize( $this->value() ); $this->json['choices'] = $this->choices; $this->json['link'] = $this->get_link(); $this->json['id'] = $this->id; $this->json['inputAttrs'] = ''; foreach ( $this->input_attrs as $attr => $value ) { $this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" '; } $defaults = array( 'font-family' => false, 'font-size' => false, 'variant' => false, 'line-height' => false, 'letter-spacing' => false, 'word-spacing' => false, 'color' => false, 'text-align' => false, ); $this->json['default'] = wp_parse_args( $this->json['default'], $defaults ); foreach ( $this->json['value'] as $key => $val ) { if ( isset( $this->json['default'][ $key ] ) && false === $this->json['default'][ $key ] ) { unset( $this->json['value'][ $key ] ); } } $this->json['show_variants'] = ( true === Hoo_Fonts_Google::$force_load_all_variants ) ? false : true; $this->json['show_subsets'] = ( true === Hoo_Fonts_Google::$force_load_all_subsets ) ? false : true; $this->json['languages'] = Hoo_Fonts::get_google_font_subsets(); } /** * An Underscore (JS) template for this control's content (but not its container). * * Class variables for this control class are available in the `data` JS object; * export custom variables by overriding {@see WP_Customize_Control::to_json()}. * * @see WP_Customize_Control::print_template() * * @access protected */ protected function content_template() { ?>