wppaste
WordPress

WP_Customize_Color_Control::content_template()

Since
4.1.0
Source
wp-includes/customize/class-wp-customize-color-control.php:93
Render a JS template for the content of the color picker control.

Source

	public function content_template() {		?>		<#		var defaultValue = '#RRGGBB',			defaultValueAttr = '',			inputId = _.uniqueId( 'customize-color-control-input-' ),			isHueSlider = data.mode === 'hue'; 		if ( data.defaultValue && _.isString( data.defaultValue ) && ! isHueSlider ) {			if ( '#' !== data.defaultValue.substring( 0, 1 ) ) {				defaultValue = '#' + data.defaultValue;			} else {				defaultValue = data.defaultValue;			}			defaultValueAttr = ' data-default-color=' + defaultValue; // Quotes added automatically.		}		#>		<# if ( data.label ) { #>			<span class="customize-control-title">{{{ data.label }}}</span>		<# } #>		<# if ( data.description ) { #>			<span class="description customize-control-description">{{{ data.description }}}</span>		<# } #>		<div class="customize-control-content">			<label for="{{ inputId }}"><span class="screen-reader-text">{{{ data.label }}}</span></label>			<# if ( isHueSlider ) { #>				<input id="{{ inputId }}" class="color-picker-hue" type="number" min="1" max="359" data-type="hue" />			<# } else { #>				<input id="{{ inputId }}" class="color-picker-hex" type="text" maxlength="7" placeholder="{{ defaultValue }}" {{ defaultValueAttr }} />			<# } #>		</div>		<?php	}

History

Introduced in 4.1.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/customize/class-wp-customize-color-control.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.