esc_html__( 'Invalid Value', 'kirki' ), ] ); } /** * Get the URL for the control folder. * * This is a static method because there are more controls in the Kirki framework * that use colorpickers, and they all need to enqueue the same assets. * * @static * @access public * @since 1.0 * @return string */ public static function get_control_path_url() { return URL::get_from_path( dirname( __DIR__ ) ); } /** * Refresh the parameters passed to the JavaScript via JSON. * * @access public * @since 1.0 * @see WP_Customize_Control::to_json() * @return void */ public function to_json() { $input_class = 'kirki-control-input'; if ( isset( $this->input_attrs['class'] ) ) { $input_class .= ' ' . $this->input_attrs['class']; unset( $this->input_attrs['class'] ); } // Get the basics from the parent class. parent::to_json(); // Input class name. $this->json['inputClass'] = $input_class; // Label position. $this->json['labelPosition'] = 'top'; if ( isset( $this->choices['label_position'] ) && 'bottom' === $this->choices['label_position'] ) { $this->json['labelPosition'] = 'bottom'; } // Input id. $this->json['inputId'] = '_customize-input-' . $this->id; } /** * 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 * @since 1.0 * @return void */ protected function content_template() { ?>
<# if ( 'top' === data.labelPosition ) { #> <# } #>
<# var val = ( data.value && _.isString( data.value ) ) ? data.value.replace( '%%', '%' ) : ''; #>
<# if ( 'bottom' === data.labelPosition ) { #> <# } #>