l10n = wp_parse_args( $this->l10n, array( 'family' => esc_html__( 'Font Family', 'armonia' ), 'size' => esc_html__( 'Font Size', 'armonia' ), 'weight' => esc_html__( 'Font Weight', 'armonia' ), 'color' => esc_html__( 'Font Color', 'armonia' ), 'style' => esc_html__( 'Font Style', 'armonia' ), 'line_height' => esc_html__( 'Line Height', 'armonia' ), 'inherit' => esc_html__( 'Click on custom to see changes you made here. Theme default will revert typography to the default values generated by theme', 'armonia' ) ) ); } /** * Enqueue scripts/styles. * * @since 1.0.0 * @access public * @return void */ public function enqueue() { wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_style( 'typography-customizer-controls', get_template_directory_uri() . '/inc/customizer/custom-controls/typography/typography.css', array(), ARMONIA_VERSION, 'all' ); wp_enqueue_script( 'typography-customizer-controls', get_template_directory_uri() . '/inc/customizer/custom-controls/typography/typography.js', array( 'jquery', 'wp-color-picker' ), ARMONIA_VERSION, true ); } /** * Add custom parameters to pass to the JS via JSON. * * @since 1.0.0 * @access public * @return void */ public function to_json() { parent::to_json(); // Loop through each of the settings and set up the data for it. foreach ( $this->settings as $setting_key => $setting_id ) { $this->json[ $setting_key ] = array( 'link' => $this->get_link( $setting_key ), 'value' => $this->value( $setting_key ), 'defaultValue' => $setting_id->default, 'label' => isset( $this->l10n[ $setting_key ] ) ? $this->l10n[ $setting_key ] : '' ); $this->json['initial'] = $this->initial; if ( 'family' === $setting_key ) $this->json[ $setting_key ]['choices'] = $this->get_font_families(); elseif ( 'weight' === $setting_key ) $this->json[ $setting_key ]['choices'] = $this->get_font_weight_choices(); elseif ( 'style' === $setting_key ) $this->json[ $setting_key ]['choices'] = $this->get_font_style_choices(); elseif ( 'inherit' === $setting_key ) $this->json[ $setting_key ]['choices'] = $this->get_inherit_choices(); } } /** * Underscore JS template to handle the control's output. * * @since 1.0.0 * @access public * @return void */ public function content_template() { ?> <# if( ! data.initial ) { #> <# if ( data.label ) { #>
{{ data.label }}
<# } #> <# if ( data.description ) { #> {{{ data.description }}} <# } #> <# } #> <# if( data.initial ) { #>